[Haskell-cafe] Re: Double -> CDouble, realToFrac doesn't work

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Fri Nov 5 09:30:46 EST 2004


Henning Thielemann wrote:

 >I wonder why Infinity has a sign in IEEE floating processing, as well as
 >0. To support this behaviour uniformly one would need a +0 or -0 offset
 >for each number, which would lead straightforward to non-standard analysis
 >...

See "Branch Cuts for Complex Elementary Functions, or Much Ado About 
Nothing's Sign Bit" by William Kahan, in The State of the Art in 
Numerical Analysis, (eds. Iserles and Powell), Clarendon Press, Oxford, 
1987.

(Note that I have not read this paper. However, Kahan was the primary 
architect of the IEEE floating point standard, so you can be pretty sure 
the reasons given in the paper are also the reasons IEEE floating point 
has signed zero.)

A good online presentation which mentions all kinds of interesting 
floating point pathologies, including those discussed in the above 
paper, is "How Java’s Floating-Point Hurts Everyone Everywhere" 
(http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf).

 >[...] Thus (a-b) is not the same as -(b-a) for IEEE floats!

Nor is x*0 equal to 0 for every x; nor does x == y imply f(x) == f(y) 
for every x, y, f; nor is addition or multiplication associative. There 
aren't many identities that do hold of floating point numbers.

-- Ben



More information about the Haskell-Cafe mailing list