comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: 32-bit Unsigned Integers, Was: Unsigned Integers - How?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: 32-bit Unsigned Integers, Was: Unsigned Integers - How? [message #8108] Sun, 09 February 1997 00:00
brian.jackel is currently offline  brian.jackel
Messages: 23
Registered: May 1996
Junior Member
In article <davidf-ya023080000802971828060001@news.frii.com> davidf@dfanning.com (David Fanning) writes:

> Peter Berdeklis <peter@atmosp.physics.utoronto.ca> carries on this
> discussion about 16-bit unsigned integers when he writes:

>> Unfortunately, I'm not reading 16-bit integers but 32-bit integers.
>> Sorry I forgot to mention that. So how would I pull the same trick
>> with 32-bit integers?

> Somehow, Peter, I just *knew* you didn't have 16-bit integers! :-)

Yes, that would be too easy, wouldn't it :)

Well, since it's Sunday, and I really should be writing my thesis, here's my
shot at it:

IDL> highbit= 2.0d0^31
IDL> newvalue= DOUBLE(value AND '7FFFFFFF'XL) + highbit*(value LT 0L)

which appears to do the trick on my PC and our Alpha box. I think it
should work in general, so long as IDL always puts the sign in the upper
bit. Anybody know if this is actually true? Loss of precision shouldn't
be an issue with this, as Doubles are 64 bits, so a 32 bit Long should
fit in with plenty room to spare for the exponent.

So, can anyone
a) see a problem with this and/or
b) make it faster?

waiting in anticipation (or is that procrastination?)

Brian Jackel
University of Western Ontario
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Multi-Page Postscript
Next Topic: ? Number of lines in a file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:22:30 PDT 2025

Total time taken to generate the page: 0.00497 seconds