If I print 32700+99 in IDL it gives me -32737 but 33700.0+99 gives me 33799.0. Why is IDL print wrong for 32700+99? Of course 32700.+99 gives, 32799.0, right answer.
Asked
Active
Viewed 37 times
1 Answers
1
The default integer in IDL is 16-bit, so the largest expressible integer is 32767.
IDL> print, 32767
32767
IDL> print, 32767 + 1
-32768
Floats, of course, can handle values in this range. To get a 32-bit integer, use the "L" suffix:
IDL> print, 32767L
32767
IDL> print, 32767L + 1
32768

mgalloy
- 2,356
- 1
- 12
- 10