floor(Inf) and floor(NaN) do not appear to be defined in Standard Haskell.
(They both come down to "properFraction" which is only defined for Ratio.)
This differs from (for example) the Standard ML Basis Library, where it
is specified that floor(Int) should raise Overflow and floor(NaN) should
raise Domain.  Hence Hugs and GHC do different things.

Hugs returns floor(Inf) = 0 and floor(NaN) = 0
GHC returns floor(Inf) = very very large integer and floor(NaN) = even larger
integer.  (This is because the GHC implementation of properFraction simply
ignores the case of Inf/NaN and treats the artificially high exponent encoded
in those floating-point numbers as if it were a real one.)

My own opinion is that Standard ML is right here and that floor(x) should
raise an exception (In Haskell terms, fail) when x does not correspond to a 
real number.

Reply via email to