
On Thu, 2008-01-17 at 03:16 +0100, Mitar wrote:
Hi!
On Jan 11, 2008 7:30 AM, Cristian Baboi
wrote: NaN is not 'undefined'
Why not? What is a semantic difference? I believe Haskell should use undefined instead of NaN for all operations which are mathematically undefined (like 0/0). NaN should be used in a languages which does not support such nice Haskell features. Because if Haskell would use undefined such error would propagate itself to higher levels of computations, with NaN it does not.
if bigComputation > 1 then ... else ...
Would be evaluating else semantically correct if bigComputation returns NaN? No, it is not. With undefined this is correctly (not)evaluated.
For the love of Pete, floating point numbers are not real numbers. 0/0 is mathematically defined for floating point numbers to be NaN. If you don't want to use IEEE floating point numbers, use a different type as was suggested early in this thread.