diff options
Diffstat (limited to 'stdlib/source/lux/math/complex.lux')
-rw-r--r-- | stdlib/source/lux/math/complex.lux | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/stdlib/source/lux/math/complex.lux b/stdlib/source/lux/math/complex.lux index 252e31d51..eae4fbe55 100644 --- a/stdlib/source/lux/math/complex.lux +++ b/stdlib/source/lux/math/complex.lux @@ -183,12 +183,12 @@ (if (r.= 0.0 imaginary) (r/abs real) (let [q (r./ imaginary real)] - (r.* (math;sqrt (r.+ 1.0 (r.* q q))) + (r.* (math;root2 (r.+ 1.0 (r.* q q))) (r/abs imaginary)))) (if (r.= 0.0 real) (r/abs imaginary) (let [q (r./ real imaginary)] - (r.* (math;sqrt (r.+ 1.0 (r.* q q))) + (r.* (math;root2 (r.+ 1.0 (r.* q q))) (r/abs real)))) )))) @@ -234,9 +234,9 @@ (-> Real Real Real) (r.* (r/signum sign) magnitude)) -(def: #export (sqrt (^@ input (^slots [#real #imaginary]))) +(def: #export (root2 (^@ input (^slots [#real #imaginary]))) (-> Complex Complex) - (let [t (|> input c.abs (get@ #real) (r.+ (r/abs real)) (r./ 2.0) math;sqrt)] + (let [t (|> input c.abs (get@ #real) (r.+ (r/abs real)) (r./ 2.0) math;root2)] (if (r.>= 0.0 real) {#real t #imaginary (r./ (r.* 2.0 t) @@ -245,9 +245,9 @@ (r/abs imaginary)) #imaginary (r.* t (copy-sign imaginary 1.0))}))) -(def: #export (sqrt-1z input) +(def: #export (root2-1z input) (-> Complex Complex) - (|> (complex 1.0) (c.- (c.* input input)) sqrt)) + (|> (complex 1.0) (c.- (c.* input input)) root2)) (def: #export (reciprocal (^slots [#real #imaginary])) (-> Complex Complex) @@ -267,14 +267,14 @@ (def: #export (acos input) (-> Complex Complex) (|> input - (c.+ (|> input sqrt-1z (c.* i))) + (c.+ (|> input root2-1z (c.* i))) log (c.* (c.negate i)))) (def: #export (asin input) (-> Complex Complex) (|> input - sqrt-1z + root2-1z (c.+ (c.* i input)) log (c.* (c.negate i)))) |