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

Home » Public Forums » archive » Re: Bug in ISHFT? (NOT)
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: Bug in ISHFT? (NOT) [message #39652] Mon, 31 May 2004 23:07
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
Craig Markwardt wrote:
> Craig Markwardt <craigmnet@REMOVEcow.physics.wisc.edu> writes:
>
>> Would anybody call this a bug in IDL?
>>
>> IDL> print, ishft(6UL,40UL)
>> 1536
>> IDL> print, ishft(6UL,8UL)
>> 1536
>>
>> ISHFT only seems to handle integers up to 32 bits, and then wraps
>> around.
>
>
> ... or rather, I had a bug in my brain. Somehow I was mixing up
> unsigned long and unsigned long64. My mistake.

I think there was a point in bringing it up:

At least its not really consistent:

IDL> print,ishft(1b,8)
0
IDL> print,ishft(1,16)
0
IDL> print,ishft(1L,32)
1
IDL> print,ishft(1LL,64)
1

One could think that for 8 and 16 bit there is no wrap-around, but for
32 and 64 there is.
But:

IDL> print,ishft(2ULL,63)
0
IDL> print,ishft(2ULL,64)
2
So for 32 and 64 bits, ISHFT divides the second paramter modulo
32 or 64 respectively before applying it, but not for 8 and 16 bit.

marc
Re: Bug in ISHFT? (NOT) [message #39657 is a reply to message #39652] Sun, 30 May 2004 21:06 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Craig Markwardt <craigmnet@REMOVEcow.physics.wisc.edu> writes:
> Would anybody call this a bug in IDL?
>
> IDL> print, ishft(6UL,40UL)
> 1536
> IDL> print, ishft(6UL,8UL)
> 1536
>
> ISHFT only seems to handle integers up to 32 bits, and then wraps
> around.

... or rather, I had a bug in my brain. Somehow I was mixing up
unsigned long and unsigned long64. My mistake.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Keywords in DLM
Next Topic: About call_external, AUTO_GLUE and gcc

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

Current Time: Wed Oct 08 09:12:07 PDT 2025

Total time taken to generate the page: 0.00829 seconds