[Haskell-cafe] Re: 0/0 > 1 == False
David Roundy
droundy at darcs.net
Fri Jan 11 12:03:36 EST 2008
On Fri, Jan 11, 2008 at 02:54:20PM +0100, Achim Schneider wrote:
> +-0 / +-0 is always NaN 'cos you can't tell which one is bigger and
> thus can't decide between positive and negative Infinity, and it
> isn't both, either.
>
> But then there's +0/0 and -0/0, which would be +Infinity and
> -Infinity, and +0 > 0 > -0. AFAIK there are no floats with three zero
> values, though.
No, +0/0 might be 0 or finite instead of +Infinity, so it's a NaN.
e.g. consider
Prelude> let x=1e-300/1e300
Prelude> x
0.0
Prelude> x/x
NaN
The "true" answer here is that x/x == 1.0 (not 0 or +Infinity), but there's
no way for the computer to know this, so it's NaN.
--
David Roundy
Department of Physics
Oregon State University
More information about the Haskell-Cafe
mailing list