gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] Re: [Maxima] float to bfloat


From: Steve Haflich
Subject: Re: [Gcl-devel] Re: [Maxima] float to bfloat
Date: Mon, 26 Jan 2004 20:26:03 -0800

   From: Camm Maguire <address@hidden>
   
   My understanding is that the Common Lisp spec is silent on an
   implementation's treatment of Nan and Inf.  If so, and we are
   implicitly free to implement them in a useful way, I'd be happy to do
   so for maxima's benefit.  Paul, can we define NaN, and Inf as symbols
   with floating point constant values, and 1/0, -1/0, and 0/0 as
   analogous rationals?  What would be useful rules regarding expressions
   involving these symbols, beyond NaN - NaN = NaN et. al. mentioned
   above? 

The above may make sense to mathematicians in the context of Macsyma
but as a Common Lisp implementor I don't believe it is compatible with
the other real-world constraints on Common Lisp.  Mathematically
consistent treatment of the IEEE exceptional fp values (the Infinities
and NaNs) in both their generation and detection is hard to reconcile
with achieving raw platform fp speed.  In other computational contexts
fp speed is a desirable language requirement.  Some guy named Fateman
coauthored a paper about this -- you should look it up.

Implementatonally, supporting floating Infinities and NaNs raise many
questions in trying to balance consistency, performance, and
mathematical correctness.  I can't pretend even to be competent to
list them all, but comparisons are particularly tricky.  If the
Infinities and NaNs are structurally represented as floats (as
provided by IEEE) then the type system (both gf descriminators and the
ancient `generic' arithmetic functions) will treat them that way.

What should be the result of these?

 (- infinity-single infinity-single)
 (= infinity-single infinity-single)
 (= infinity-single infinity-double)
 (> infinity-single infinity-double)

Re the proposed 1/0 value, do you intend a computational 3/0 to
normalize to 1/0?  And what about contagion, and especially
comparisons across types?:

 (- infinity-single 1/0)
 (/ infinity-single 1/0)
 (= infinity-single 1/0)

I suppose nearly all serious platforms pretty much support IEEE these
days, and FPUs have lotsa neat status bits to get the behavior the
imlpementation wants, but experience moer than a decade ago showed it
is hard to guarantee that mad-prion routines here and there don't mess
with these bits and forget to restore them.




reply via email to

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