aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2018-02-24 17:10:44 -0400
committerEduardo Julian2018-02-24 17:10:44 -0400
commit9bf491a18e4b772505c3767cf0249eb24f0a822b (patch)
treece047676228e395f131abc7304a1284ebb1a69ed /stdlib/source
parentcabb410d67edcdcb3531a990518ca67de4507f07 (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/source/lux/data/number/complex.lux6
-rw-r--r--stdlib/source/lux/math.lux7
2 files changed, 5 insertions, 8 deletions
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)