[Haskell-cafe] Re: Double -> CDouble, realToFrac doesn't work
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Fri Nov 5 10:13:47 EST 2004
On Fri, 2004-11-05 at 13:57, Henning Thielemann wrote:
> On Fri, 5 Nov 2004, Robert Dockins wrote:
>
> > What IEEE has done is shoehorned in some values that aren't really
> > numbers into their representation (NaN certainly; one could make a
> > convincing argument that +Inf and -Inf aren't numbers).
>
> 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
It is related to the decision to have signed infinity. One rationale is
thus:
The identity
1/(1/x) = x
is only true for all IEEE floats x if we have signed 0. In particular if
x is -infinity then 1/(-infinity) would be 0 and 1/0 = +infinity in the
IEEE floating point system. So if we preserve the sign for overflow
(+-infinity), we also need to preserve the sign for underflow (+-0) or
other identities fail.
Note that -0 == +0
See: What Every Computer Scientist Should Know About Floating Point
Arithmetic
http://citeseer.ist.psu.edu/goldberg91what.html
page 183.
Duncan
More information about the Haskell-Cafe
mailing list