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

Home » Public Forums » archive » print, long(1.0e10)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: print, long(1.0e10) [message #16660 is a reply to message #16541] Mon, 09 August 1999 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
Gary Fu <gfu@seadas.gsfc.nasa.gov> writes:

> I got different results from the following example on SGI IRIX and PC
> Linux:
> a = 1.0e10
> b = long(a)
> print, b ; 2147483647 for IRIX, -2147483648 for Linux

> It looks like that IRIX and Linux handle it differently when assigning a
> floating value greater (or less) than the boundary of a long integer to
> a long variable. Should I always check the range of 'a' before
> assigning it to a 'long' variable to make the result consistent on IRIX
> and Linux ?

It appears that Digital Unix gives yet another answer:

IDL> a = 1.0e10
IDL> b = long(a)
% Program caused arithmetic error: Floating illegal operand
IDL> print, b
1410065408

which makes sense, since that's A modulo 2^32.

William Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL> WHY IS THIS A NULL FILENAME
Next Topic: Re: transfering data files

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

Current Time: Sun Apr 26 15:38:58 PDT 2026

Total time taken to generate the page: 1.84311 seconds