[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: printing IEEE 754 special values (inf, nan)

From: Robert Dodier
Subject: [Gcl-devel] Re: printing IEEE 754 special values (inf, nan)
Date: Wed, 6 Jul 2005 23:26:23 -0700 (PDT)

Hi Ray, you wrote:

> I think that if you have readable NaN's, you should make
> it so that what you read is what was written.  It would
> certainly break people's expectation if all printed NaN's
> got read as the same NaN.

Well, I'm not sure that anyone actually expects the
input string "NaN" to read the same as the floating point
object of which it is a representation.

For what it's worth, the two numerical packages
I'm familiar with, Octave and R, both allow NaN to be
read in as a string, and it's the same string that is
printed to represent any floating point NaN.
I claim this is evidence indistinguishable NaN's are OK.

> Also, I think implementations are free to encode whatever
> they want in the bits, so it might be important for the 
> implementation.  But I might be wrong here.

Does any Lisp implementation do so? Does CMUCL? GCL? 
If the Lisp implementation leaves all the numerical 
stuff to C library functions and/or floating point hardware,
I guess we can transfer the question to those.

I guess if we find a need to preserve NaN bits, 
NaN could be printed as NAN-FE6B-234E-CA09-BF72 
or something. I suppose we can have a global
flag *print-nan-bits* to switch between that and NAN.

Robert Dodier

Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]