aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/math.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/math.lux29
1 files changed, 15 insertions, 14 deletions
diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux
index 46b5171ee..ffe990c50 100644
--- a/stdlib/source/test/lux/math.lux
+++ b/stdlib/source/test/lux/math.lux
@@ -7,7 +7,8 @@
[data
["." bit ("#@." equivalence)]
[number
- ["." frac]]]]
+ ["." int]
+ ["f" frac]]]]
{1
["." /]}
["." / #_
@@ -19,8 +20,8 @@
(def: (within? margin-of-error standard value)
(-> Frac Frac Frac Bit)
- (f/< margin-of-error
- (frac.abs (f/- standard value))))
+ (f.< margin-of-error
+ (f.abs (f.- standard value))))
(def: margin Frac +0.0000001)
@@ -35,7 +36,7 @@
($_ _.and
(<| (_.context "Trigonometry")
(do r.monad
- [angle (|> r.safe-frac (:: @ map (f/* /.tau)))]
+ [angle (|> r.safe-frac (:: @ map (f.* /.tau)))]
($_ _.and
(_.test "Sine and arc-sine are inverse functions."
(trigonometric-symmetry /.sin /.asin angle))
@@ -46,26 +47,26 @@
)))
(<| (_.context "Rounding")
(do r.monad
- [sample (|> r.safe-frac (:: @ map (f/* +1000.0)))]
+ [sample (|> r.safe-frac (:: @ map (f.* +1000.0)))]
($_ _.and
(_.test "The ceiling will be an integer value, and will be >= the original."
(let [ceil'd (/.ceil sample)]
- (and (|> ceil'd frac-to-int int-to-frac (f/= ceil'd))
- (f/>= sample ceil'd)
- (f/<= +1.0 (f/- sample ceil'd)))))
+ (and (|> ceil'd f.int int.frac (f.= ceil'd))
+ (f.>= sample ceil'd)
+ (f.<= +1.0 (f.- sample ceil'd)))))
(_.test "The floor will be an integer value, and will be <= the original."
(let [floor'd (/.floor sample)]
- (and (|> floor'd frac-to-int int-to-frac (f/= floor'd))
- (f/<= sample floor'd)
- (f/<= +1.0 (f/- floor'd sample)))))
+ (and (|> floor'd f.int int.frac (f.= floor'd))
+ (f.<= sample floor'd)
+ (f.<= +1.0 (f.- floor'd sample)))))
(_.test "The round will be an integer value, and will be < or > or = the original."
(let [round'd (/.round sample)]
- (and (|> round'd frac-to-int int-to-frac (f/= round'd))
- (f/<= +1.0 (frac.abs (f/- sample round'd))))))
+ (and (|> round'd f.int int.frac (f.= round'd))
+ (f.<= +1.0 (f.abs (f.- sample round'd))))))
)))
(<| (_.context "Exponentials and logarithms")
(do r.monad
- [sample (|> r.safe-frac (:: @ map (f/* +10.0)))]
+ [sample (|> r.safe-frac (:: @ map (f.* +10.0)))]
(_.test "Logarithm is the inverse of exponential."
(|> sample /.exp /.log (within? +0.000000000000001 sample)))))
(<| (_.context "Greatest-Common-Divisor and Least-Common-Multiple")