Re: Unknown #INFO [message #13443 is a reply to message #13433] |
Thu, 12 November 1998 00:00   |
steinhh
Messages: 260 Registered: June 1994
|
Senior Member |
|
|
In article <72d8sr$9at$1@agate.berkeley.edu>
korpela@albert.ssl.berkeley.edu (Eric J. Korpela) writes:
> In article <MPG.10b3c2392717b0898971a@news.frii.com>,
> David Fanning <davidf@dfanning.com> wrote:
>>
>> IDL> Help, !Values, /Structure
>> ** Structure !VALUES, 4 tags, length=24:
>> F_INFINITY FLOAT 1.#INF0
>> F_NAN FLOAT 1.#QNAN
>> D_INFINITY DOUBLE 1.#INF000
>> D_NAN DOUBLE 1.#QNAN00
>>
>> I don't know. This may be a Windows thing. Looks a little
>> Bill Gatesh, doesn't it. :-)
>
> Yes it does look windowish. It probably has something to do
> with the compiler they used to make their windows version. What
> concerns me is how this affects reading and writing of text files.
> In the past I have relied on IDL correctly parsing 'Inf' and 'NaN'
> in input files. You can see the obvious portability problem.
>
> I'm not sure if IEEE specifies the text representation of 'Inf'
> and 'NaN' or if a program is required to be able to correctly parse
> them on input.
>
> Out of curiousity, could you try the following?
>
> print,float('Inf')
> print,float('1.#INF0')
>
> My sun gives this:
> IDL> print,!version
> { sparc sunos unix 5.0 Apr 28 1997}
> IDL> print,!values
> { Inf NaN Infinity NaN}
> IDL> print,float('Inf')
> Inf
> IDL> print,float('1.#INF0')
> 1.00000
I guess you're right on the spot with the assumption that the
compiler (or rather, the c library) makes the difference:
IDL> print,!version
{ alpha OSF unix 5.1.1 Jul 20 1998}
IDL> print,!values
{ INF NaNQ INF NaNQ}
IDL> print,float(['INF','Inf','NaN','nanq'])
% Type conversion error: Unable to convert given STRING to Float.
% Detected at: $MAIN$
INF INF 0.00000 NaNQ
So apparently, case doesn't matter, but the particular *spelling*
convention does make a difference, and that's even between two
unix flavors! What a bummer.. So much for the days when ascii
files were portable.. :-)
One other caveat:
IDL> print,float(['-Inf','Inf']),-float('Inf')
INF INF
-INF
So the sign isn't picked up. But this again may be platform
specific.... then again, I never expected it to be possible
to do float('NaNQ') in the first place :-)
Regards,
Stein Vidar
|
|
|