Re: ishft(-32768,-1) = 2147467264 ? [message #9355 is a reply to message #9338] |
Thu, 19 June 1997 00:00  |
George McCabe
Messages: 23 Registered: June 1997
|
Junior Member |
|
|
> (Can't remember what the IDL equivilent of info is...)
the IDL equivalent to info is help
> Basically, IDL parses '-' as the unary operator, operating on an
> unsigned constant, not as part of the constant. This problem
> arises in other languages which lack explicit typing of embedded
> constants.
Is it true that IDL interprets the explicitly typed fix(-32768) as a
negative constant and not as an operator and an unsigned constant?
Thanx for the mail.
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV VVVVVVVV
George McCabe (HSTX) NASA / GSFC
Tel: (301)286-8283, Fax: (301)286-0212 Code 693, B2 R151
E-mail: george.mccabe@gsfc.nasa.gov Greenbelt, MD 20912
reply to mail message quoted below>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Basically, because 32768 is a long integer. When IDL parses the
line of code
x=-32768
it sees it as
"x becomes equal to the additive inverse of 32768"
Since 32678 is greater than the biggest possible integer, it is
made a long integer. Compare the following
WAVE> x=-32768
WAVE> info, x
X LONG = -32768
WAVE> x=-32767-1
WAVE> info, x
X INT = -32768
(Can't remember what the IDL equivilent of info is...)
Basically, IDL parses '-' as the unary operator, operating on an
unsigned constant, not as part of the constant. This problem
arises in other languages which lack explicit typing of embedded
constants.
Cheers, Stephen
Stephen Ritcey (902)494-3313 (voice) (902)494-5191 (fax)
Physics Dept., Dalhousie Univ., Halifax, N.S., Canada B3H 3J5
|
|
|