* 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
This commit is contained in:
parent
610c0568c4
commit
e03cafe16c
@ -1,3 +1,7 @@
|
|||||||
|
Thu Jun 11 21:05:09 2009 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* lib/cmath.rb (exp): omitted redundant function call.
|
||||||
|
|
||||||
Thu Jun 11 17:49:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Jun 11 17:49:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.
|
* ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.
|
||||||
|
23
lib/cmath.rb
23
lib/cmath.rb
@ -28,8 +28,9 @@ module CMath
|
|||||||
if z.real?
|
if z.real?
|
||||||
exp!(z)
|
exp!(z)
|
||||||
else
|
else
|
||||||
Complex(exp!(z.real) * cos!(z.imag),
|
ere = exp!(z.real)
|
||||||
exp!(z.real) * sin!(z.imag))
|
Complex(ere * cos!(z.imag),
|
||||||
|
ere * sin!(z.imag))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ module CMath
|
|||||||
if z.real?
|
if z.real?
|
||||||
tan!(z)
|
tan!(z)
|
||||||
else
|
else
|
||||||
sin(z)/cos(z)
|
sin(z) / cos(z)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -156,14 +157,6 @@ module CMath
|
|||||||
end
|
end
|
||||||
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)
|
def asinh(z)
|
||||||
if z.real?
|
if z.real?
|
||||||
asinh!(z)
|
asinh!(z)
|
||||||
@ -172,6 +165,14 @@ module CMath
|
|||||||
end
|
end
|
||||||
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)
|
def atanh(z)
|
||||||
if z.real? and z >= -1 and z <= 1
|
if z.real? and z >= -1 and z <= 1
|
||||||
atanh!(z)
|
atanh!(z)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user