Changeset 5387
- Timestamp:
- 07/11/05 04:12:53 (3 years ago)
- svk:copy_cache_prev:
- 7349
- Location:
- src/Pugs
- Files:
-
- 2 modified
-
Prim.hs (modified) (3 diffs)
-
Prim/Numeric.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim.hs
r5384 r5387 138 138 op1 "+" = op1Numeric id 139 139 op1 "abs" = op1Numeric abs 140 -- op1 "floor" = op1Cast $ op1Roundy floor 141 -- op1 "truncate" = op1Cast $ op1Roundy truncate 142 -- op1 "ceiling" = op1Cast $ op1Roundy ceiling 143 -- op1 "round" = op1Cast $ op1Roundy round 140 op1 "Pugs::Internals::truncate" = op1Round truncate 141 op1 "Pugs::Internals::round" = op1Round round 142 op1 "Pugs::Internals::floor" = op1Round floor 143 op1 "Pugs::Internals::ceiling" = op1Round ceiling 144 144 op1 "cos" = op1Floating cos 145 145 op1 "sin" = op1Floating sin … … 583 583 fmap castV (liftIO $ fun val) 584 584 585 {-586 op1Roundy func x587 | VInt x' <- x588 = return x'589 | VRat x' <- x590 = return . VInt $ func x'591 | otherwise = 0592 -}593 594 585 returnList :: [Val] -> Eval Val 595 586 returnList vals = ifListContext … … 1357 1348 \\n Num spre + safe (Num)\ 1358 1349 \\n Num pre abs safe (?Num=$_)\ 1359 \\n Int pre truncate safe (?Num=$_)\1360 \\n Int pre roundsafe (?Num=$_)\1361 \\n Int pre floorsafe (?Num=$_)\1362 \\n Int pre ceilingsafe (?Num=$_)\1350 \\n Int pre Pugs::Internals::truncate safe (?Num=$_)\ 1351 \\n Int pre Pugs::Internals::round safe (?Num=$_)\ 1352 \\n Int pre Pugs::Internals::floor safe (?Num=$_)\ 1353 \\n Int pre Pugs::Internals::ceiling safe (?Num=$_)\ 1363 1354 \\n Num pre atan safe (Num)\ 1364 1355 \\n Num pre atan safe (Num, Num)\ -
src/Pugs/Prim/Numeric.hs
r2989 r5387 3 3 4 4 module Pugs.Prim.Numeric ( 5 op2Numeric, op1Floating, op1 Numeric,5 op2Numeric, op1Floating, op1Round, op1Numeric, 6 6 op2Exp, op2Divide, op2Modulus, 7 7 ) where … … 36 36 foo <- fromVal v 37 37 return $ VNum $ f foo 38 39 op1Round :: (Double -> Integer) -> Val -> Eval Val 40 op1Round 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 38 46 39 47 op1Numeric :: (forall a. (Num a) => a -> a) -> Val -> Eval Val
