diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-11 12:08:30 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-11 12:08:30 +0000 |
commit | e03cafe16c38826128b58bcd4767f82cc312ab26 (patch) | |
tree | 6a27362c7be530ea0fe14a165bda81b9ddc67bc5 /lib/cmath.rb | |
parent | 610c0568c4f14f11f824a7d30bfe4c51e11b0b7a (diff) |
* lib/cmath.rb (exp): omitted redundant function call.
and some adjustments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cmath.rb')
-rw-r--r-- | lib/cmath.rb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/cmath.rb b/lib/cmath.rb index 31c5a59c99..d9e53f361a 100644 --- a/lib/cmath.rb +++ b/lib/cmath.rb @@ -28,8 +28,9 @@ module CMath if z.real? exp!(z) else - Complex(exp!(z.real) * cos!(z.imag), - exp!(z.real) * sin!(z.imag)) + ere = exp!(z.real) + Complex(ere * cos!(z.imag), + ere * sin!(z.imag)) end end @@ -94,7 +95,7 @@ module CMath if z.real? tan!(z) else - sin(z)/cos(z) + sin(z) / cos(z) end end @@ -156,14 +157,6 @@ module CMath end end - def acosh(z) - if z.real? and z >= 1 - acosh!(z) - else - log(z + sqrt(z * z - 1.0)) - end - end - def asinh(z) if z.real? asinh!(z) @@ -172,6 +165,14 @@ module CMath end end + def acosh(z) + if z.real? and z >= 1 + acosh!(z) + else + log(z + sqrt(z * z - 1.0)) + end + end + def atanh(z) if z.real? and z >= -1 and z <= 1 atanh!(z) |