Show
Ignore:
Timestamp:
12/03/05 07:32:09 (3 years ago)
Author:
luqui
svk:copy_cache_prev:
10519
Message:

Darn. Rolled back my "fixes", because of Larry's decree that
we should follow IEEE floating point, even if it is broken.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Numeric.hs

    r8054 r8055  
    6161            if isDigit . head $ show (num1 :: VNum) 
    6262                then op2Rat ((^^) :: VRat -> VInt -> VRat) x y 
    63                 else op2Num numExp x y 
    64         _ -> op2Num numExp x y 
    65     where 
    66     numExp :: VNum -> VNum -> VNum 
    67     -- Perl 6 differs from Haskell in the floating point spec wrt Infinity and NaN 
    68     numExp x y  
    69         | x == 1/0 && y == 0                           = 0/0 
    70         | x == 0  && y < 0                             = 0/0 
    71         | y == 1/0 && (x == 1 || x <= -1)              = 0/0  
    72         | y == -1/0 && (x == 1 || (x >= -1 && x <= 0)) = 0/0  
    73         | otherwise                                    = x ** y 
     63                else op2Num ((**) :: VNum -> VNum -> VNum) x y 
     64        _ -> op2Num ((**) :: VNum -> VNum -> VNum) x y 
    7465 
    7566op2Divide :: Val -> Val -> Eval Val 
     
    8677    = op2Num (/) x y 
    8778    where 
    88     err = fail "Illegal division by zero"  -- XXX why not NaN? 
     79    err = fail "Illegal division by zero" 
    8980 
    9081op2Modulus :: Val -> Val -> Eval Val