Changeset 8800

Show
Ignore:
Timestamp:
01/27/06 13:35:58 (3 years ago)
Author:
audreyt
Message:

* nnunley caught that 0**NaN should be NaN, not 0.

Files:
2 modified

Legend:

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

    r8736 r8800  
    5656op2Exp x y = do 
    5757    num1 <- fromVal =<< fromVal' x 
     58    if isNaN num1 then return (VNum (0/0)) else do 
    5859    if num1 == (1 :: VNum) then return (VInt 1) else do 
    5960    num2 <- fromVal =<< fromVal' y 
     61    if isNaN num2 then return (VNum (0/0)) else do 
    6062    if num2 == (0 :: VNum) then return (VInt 1) else do 
    6163    case reverse $ show (num2 :: VNum) of 
     
    6668                else op2Num ((**) :: VNum -> VNum -> VNum) x y 
    6769        _ -> op2Num ((**) :: VNum -> VNum -> VNum) x y 
     70    where 
     71    _NaN = 0/0 
    6872 
    6973op2Divide :: Val -> Val -> Eval Val 
  • t/builtins/math/NaN.t

    r8798 r8800  
    44use Test; 
    55 
    6 plan 5; 
     6plan 6; 
    77 
    88# Undeterminate Math results 
     
    1313is Inf / Inf, NaN, "Inf / Inf"; 
    1414is Inf - Inf, NaN, "Inf - Inf"; 
     15is NaN ** 0,  NaN, "NaN ** 0"; 
    1516 
    1617# XXX - the semantics below are unspecified.