Show
Ignore:
Timestamp:
07/11/05 04:12:53 (3 years ago)
Author:
putter
svk:copy_cache_prev:
7349
Message:

Finished haskell versions of floor,ceiling,round,truncate. mugwump++. Given the new r5385 Prelude.pm versions, I dropped them in Pugs::Internals. These two need to be syncronized with Emit/PIR.hs.

Files:
1 modified

Legend:

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

    r2989 r5387  
    33 
    44module Pugs.Prim.Numeric ( 
    5     op2Numeric, op1Floating, op1Numeric, 
     5    op2Numeric, op1Floating, op1Round, op1Numeric, 
    66    op2Exp, op2Divide, op2Modulus, 
    77) where 
     
    3636    foo <- fromVal v 
    3737    return $ VNum $ f foo 
     38 
     39op1Round :: (Double -> Integer) -> Val -> Eval Val 
     40op1Round f v = do 
     41    return $ VInt $ case v of 
     42       VInt i -> i 
     43       VRat r -> f ((fromRational r)::Double) 
     44       VNum n -> f n 
     45       _      -> 0 
    3846 
    3947op1Numeric :: (forall a. (Num a) => a -> a) -> Val -> Eval Val