diff options
author | Eduardo Julian | 2018-02-24 17:10:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-02-24 17:10:44 -0400 |
commit | 9bf491a18e4b772505c3767cf0249eb24f0a822b (patch) | |
tree | ce047676228e395f131abc7304a1284ebb1a69ed /stdlib/test | |
parent | cabb410d67edcdcb3531a990518ca67de4507f07 (diff) |
- Removed the "root2" and "root3" host procedures (their functionality is redundant, in the presence of the "pow" procedure).
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/data/color.lux | 8 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/number/complex.lux | 9 | ||||
-rw-r--r-- | stdlib/test/test/lux/math.lux | 16 |
3 files changed, 9 insertions, 24 deletions
diff --git a/stdlib/test/test/lux/data/color.lux b/stdlib/test/test/lux/data/color.lux index ed62a221f..29081715b 100644 --- a/stdlib/test/test/lux/data/color.lux +++ b/stdlib/test/test/lux/data/color.lux @@ -23,10 +23,10 @@ (-> @.Color @.Color Frac) (let [[fr fg fb] (@.unpack from) [tr tg tb] (@.unpack to)] - (math.root2 ($_ f/+ - (|> (scale tr) (f/- (scale fr)) square) - (|> (scale tg) (f/- (scale fg)) square) - (|> (scale tb) (f/- (scale fb)) square))))) + (math.pow 0.5 ($_ f/+ + (|> (scale tr) (f/- (scale fr)) square) + (|> (scale tg) (f/- (scale fg)) square) + (|> (scale tb) (f/- (scale fb)) square))))) (def: error-margin Frac 1.8) diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux index 98138d9fe..8369ad676 100644 --- a/stdlib/test/test/lux/data/number/complex.lux +++ b/stdlib/test/test/lux/data/number/complex.lux @@ -143,7 +143,7 @@ (let [signum-abs (|> x &.c/signum &.c/abs (get@ #&.real))] (or (f/= 0.0 signum-abs) (f/= 1.0 signum-abs) - (f/= (math.root2 2.0) signum-abs)))) + (f/= (math.pow 0.5 2.0) signum-abs)))) (test "Negation is its own inverse." (let [there (&.c/negate x) @@ -162,7 +162,8 @@ (|> normal forward backward (within? margin-of-error normal)))) (context: "Trigonometry" - (<| (times +100) + (<| (seed +17274883666004960943) + ## (times +100) (do @ [angle (|> gen-complex (:: @ map (|>> (update@ #&.real (f/% 1.0)) (update@ #&.imaginary (f/% 1.0)))))] @@ -181,8 +182,8 @@ (do @ [x gen-complex] ($_ seq - (test "Square root is inverse of power 2.0" - (|> x (&.pow' 2.0) &.root2 (within? margin-of-error x))) + (test "Root 2 is inverse of power 2." + (|> x (&.pow' 2.0) (&.pow' 0.5) (within? margin-of-error x))) (test "Logarithm is inverse of exponentiation." (|> x &.log &.exp (within? margin-of-error x))) diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index b95751dbc..80ca6995c 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -35,22 +35,6 @@ (trigonometric-symmetry &.tan &.atan angle)) )))) -(context: "Roots" - (<| (times +100) - (do @ - [factor (|> r.nat (:: @ map (|>> (n/% +1000) - (n/max +1) - nat-to-int - int-to-frac))) - base (|> r.frac (:: @ map (f/* factor)))] - ($_ seq - (test "Square-root is inverse of square." - (|> base (&.pow 2.0) &.root2 (f/= base))) - - (test "Cubic-root is inverse of cube." - (|> base (&.pow 3.0) &.root3 (f/= base))) - )))) - (context: "Rounding" (<| (times +100) (do @ |