diff options
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser/proc/common.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/js/proc/common.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/proc/common.clj | 4 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/extension/analysis/common.lux | 2 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux | 4 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux | 4 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/analysis/procedure/common.lux | 2 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/common.lux | 11 | ||||
-rw-r--r-- | stdlib/source/lux/data/number/complex.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/math.lux | 7 | ||||
-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 |
13 files changed, 18 insertions, 63 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index e3951da18..f43781276 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -383,8 +383,6 @@ ^:private analyse-math-tanh "tanh" ^:private analyse-math-exp "exp" ^:private analyse-math-log "log" - ^:private analyse-math-root2 "root2" - ^:private analyse-math-root3 "root3" ^:private analyse-math-ceil "ceil" ^:private analyse-math-floor "floor" ^:private analyse-math-round "round" @@ -602,8 +600,6 @@ "lux math tanh" (analyse-math-tanh analyse exo-type ?values) "lux math exp" (analyse-math-exp analyse exo-type ?values) "lux math log" (analyse-math-log analyse exo-type ?values) - "lux math root2" (analyse-math-root2 analyse exo-type ?values) - "lux math root3" (analyse-math-root3 analyse exo-type ?values) "lux math ceil" (analyse-math-ceil analyse exo-type ?values) "lux math floor" (analyse-math-floor analyse exo-type ?values) "lux math round" (analyse-math-round analyse exo-type ?values) diff --git a/luxc/src/lux/compiler/js/proc/common.clj b/luxc/src/lux/compiler/js/proc/common.clj index 1fe6f2e5e..cb16813d9 100644 --- a/luxc/src/lux/compiler/js/proc/common.clj +++ b/luxc/src/lux/compiler/js/proc/common.clj @@ -410,8 +410,6 @@ ^:private compile-math-tanh "tanh" ^:private compile-math-exp "exp" ^:private compile-math-log "log" - ^:private compile-math-root2 "sqrt" - ^:private compile-math-root3 "cbrt" ^:private compile-math-ceil "ceil" ^:private compile-math-floor "floor" ^:private compile-math-round "round" @@ -568,8 +566,6 @@ "tanh" (compile-math-tanh compile ?values special-args) "exp" (compile-math-exp compile ?values special-args) "log" (compile-math-log compile ?values special-args) - "root2" (compile-math-root2 compile ?values special-args) - "root3" (compile-math-root3 compile ?values special-args) "ceil" (compile-math-ceil compile ?values special-args) "floor" (compile-math-floor compile ?values special-args) "round" (compile-math-round compile ?values special-args) diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index b23a59ce1..67536f3fe 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -689,8 +689,6 @@ ^:private compile-math-tanh "tanh" ^:private compile-math-exp "exp" ^:private compile-math-log "log" - ^:private compile-math-root2 "sqrt" - ^:private compile-math-root3 "cbrt" ^:private compile-math-ceil "ceil" ^:private compile-math-floor "floor" ) @@ -961,8 +959,6 @@ "tanh" (compile-math-tanh compile ?values special-args) "exp" (compile-math-exp compile ?values special-args) "log" (compile-math-log compile ?values special-args) - "root2" (compile-math-root2 compile ?values special-args) - "root3" (compile-math-root3 compile ?values special-args) "ceil" (compile-math-ceil compile ?values special-args) "floor" (compile-math-floor compile ?values special-args) "round" (compile-math-round compile ?values special-args) diff --git a/new-luxc/source/luxc/lang/extension/analysis/common.lux b/new-luxc/source/luxc/lang/extension/analysis/common.lux index 1a1c8c650..9fc807f75 100644 --- a/new-luxc/source/luxc/lang/extension/analysis/common.lux +++ b/new-luxc/source/luxc/lang/extension/analysis/common.lux @@ -343,8 +343,6 @@ (install "tanh" (unary Frac Frac)) (install "exp" (unary Frac Frac)) (install "log" (unary Frac Frac)) - (install "root2" (unary Frac Frac)) - (install "root3" (unary Frac Frac)) (install "ceil" (unary Frac Frac)) (install "floor" (unary Frac Frac)) (install "round" (unary Frac Frac)) diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux index 49bf7fe27..14329e0dd 100644 --- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux @@ -380,8 +380,6 @@ [math//tanh "tanh"] [math//exp "exp"] [math//log "log"] - [math//root2 "sqrt"] - [math//root3 "cbrt"] [math//ceil "ceil"] [math//floor "floor"] [math//round "round"] @@ -602,8 +600,6 @@ (install "tanh" (unary math//tanh)) (install "exp" (unary math//exp)) (install "log" (unary math//log)) - (install "root2" (unary math//root2)) - (install "root3" (unary math//root3)) (install "ceil" (unary math//ceil)) (install "floor" (unary math//floor)) (install "round" (unary math//round)) diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux index 5ce483730..422d9da1d 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -476,8 +476,6 @@ [math//tanh "tanh"] [math//exp "exp"] [math//log "log"] - [math//root2 "sqrt"] - [math//root3 "cbrt"] [math//ceil "ceil"] [math//floor "floor"] ) @@ -741,8 +739,6 @@ (install "tanh" (unary math//tanh)) (install "exp" (unary math//exp)) (install "log" (unary math//log)) - (install "root2" (unary math//root2)) - (install "root3" (unary math//root3)) (install "ceil" (unary math//ceil)) (install "floor" (unary math//floor)) (install "round" (unary math//round)) diff --git a/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux b/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux index f51938046..0cecc3bd0 100644 --- a/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux +++ b/new-luxc/test/test/luxc/lang/analysis/procedure/common.lux @@ -304,8 +304,6 @@ ["lux math tanh" "hyperbolic tangent"] ["lux math exp" "exponentiation"] ["lux math log" "logarithm"] - ["lux math root2" "square root"] - ["lux math root3" "cubic root"] ["lux math ceil" "ceiling"] ["lux math floor" "floor"] ["lux math round" "rounding"]) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index d3f1e9cf4..a120059ce 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -142,7 +142,7 @@ (case> (#e.Success valueT) (<comp> (<reference> param subject) (:! <outputT> valueT)) - _ + (#e.Error error) false)))] ["lux nat +" n/+ Nat n/=] @@ -207,7 +207,7 @@ (case> (#e.Success valueT) (<comp> (<reference> param subject) (:! <outputT> valueT)) - _ + (#e.Error error) false)))] ["lux int +" i/+ Int i/=] @@ -397,7 +397,7 @@ (case> (#e.Success valueT) (<comp> (<reference> param subject) (:! <outputT> valueT)) - _ + (#e.Error error) false)))] ["lux deg +" d/+ Deg d/=] @@ -648,8 +648,6 @@ ["lux math tanh"] ["lux math exp"] ["lux math log"] - ["lux math root2"] - ["lux math root3"] ["lux math ceil"] ["lux math floor"] ["lux math round"])) @@ -855,8 +853,7 @@ ## Text (context: "[JVM] Text procedures" - (<| (seed +4439612689198907401) - ## (times +100) + (<| (times +100) (text-spec run-jvm))) (context: "[JS] Text procedures" diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index 876ab66d1..243723766 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -178,12 +178,12 @@ (if (f/= 0.0 imaginary) (frac/abs real) (let [q (f// imaginary real)] - (f/* (math.root2 (f/+ 1.0 (f/* q q))) + (f/* (math.pow 0.5 (f/+ 1.0 (f/* q q))) (frac/abs imaginary)))) (if (f/= 0.0 real) (frac/abs imaginary) (let [q (f// real imaginary)] - (f/* (math.root2 (f/+ 1.0 (f/* q q))) + (f/* (math.pow 0.5 (f/+ 1.0 (f/* q q))) (frac/abs real)))) )))) @@ -231,7 +231,7 @@ (def: #export (root2 (^@ input (^slots [#real #imaginary]))) (-> Complex Complex) - (let [t (|> input c/abs (get@ #real) (f/+ (frac/abs real)) (f// 2.0) math.root2)] + (let [t (|> input c/abs (get@ #real) (f/+ (frac/abs real)) (f// 2.0) (math.pow 0.5))] (if (f/>= 0.0 real) {#real t #imaginary (f// (f/* 2.0 t) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index d6001b3a6..4d65c75b8 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -40,9 +40,6 @@ [exp "lux math exp"] [log "lux math log"] - [root2 "lux math root2"] - [root3 "lux math root3"] - [ceil "lux math ceil"] [floor "lux math floor"] [round "lux math round"] @@ -72,8 +69,8 @@ (def: #export (hypotenuse catA catB) (-> Frac Frac Frac) - (root2 (f/+ (pow 2.0 catA) - (pow 2.0 catB)))) + (pow 0.5 (f/+ (pow 2.0 catA) + (pow 2.0 catB)))) (do-template [<type> <mod> <gcd> <lcm> <zero> <*> </> <->] [(def: #export (<gcd> a b) 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 @ |