Changes between Version 3 and Version 4 of Commentary/CmmExceptions


Ignore:
Timestamp:
Jan 5, 2007 9:16:35 PM (9 years ago)
Author:
p_tanski
Comment:

update on realToFrac (Infinity :: Float)

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/CmmExceptions

    v3 v4  
    2121The following code will ''fail'' to produce a floating point exception or NaN on x86 machines (recall that 0.0/0.0 is NaN ''and'' a definite FPU exception):
    2222
    23 [in GHCi]:
    24 Prelude> realToFrac (0/0 :: Float) :: Double
     23[in GHCi-6.6 on PowerPC, OS X]:
     24{{{
     25Prelude> 0.0/0.0
     26NaN
     27
     28Prelude> realToFrac (0.0/0.0) :: Double
     29Infinity
     30
     31Prelude> realToFrac (0.0/0.0 :: Float)
     325.104235503814077e38
     33
     34Prelude> realToFrac (0.0/0.0 :: Float) :: Double
     355.104235503814077e38
     36
     37Prelude> realToFrac (1.0/0.0)
     38Infinity
     39Prelude> realToFrac (1.0/0.0 :: Float)
     403.402823669209385e38
     41
     42}}}
     43
     44This bug is not due to the lack of FPU exceptions in Cmm but bears mention as the internal conversion performed in 'realToFrac' on 'Float's and might benefit from FPU exceptions.