[前][次][番号順一覧][スレッド一覧]

ruby-changes:12004

From: tadf <ko1@a...>
Date: Thu, 11 Jun 2009 21:10:41 +0900 (JST)
Subject: [ruby-changes:12004] Ruby:r23668 (trunk): * lib/cmath.rb (exp): omitted redundant function call.

tadf	2009-06-11 21:08:30 +0900 (Thu, 11 Jun 2009)

  New Revision: 23668

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23668

  Log:
    * lib/cmath.rb (exp): omitted redundant function call.
    and some adjustments.

  Modified files:
    trunk/ChangeLog
    trunk/lib/cmath.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23667)
+++ ChangeLog	(revision 23668)
@@ -1,3 +1,7 @@
+Thu Jun 11 21:05:09 2009  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/cmath.rb (exp): omitted redundant function call.
+
 Thu Jun 11 17:49:33 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.
Index: lib/cmath.rb
===================================================================
--- lib/cmath.rb	(revision 23667)
+++ lib/cmath.rb	(revision 23668)
@@ -28,8 +28,9 @@
     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 @@
     if z.real?
       tan!(z)
     else
-      sin(z)/cos(z)
+      sin(z) / cos(z)
     end
   end
 
@@ -156,6 +157,14 @@
     end
   end
 
+  def asinh(z)
+    if z.real?
+      asinh!(z)
+    else
+      log(z + sqrt(1.0 + z * z))
+    end
+  end
+
   def acosh(z)
     if z.real? and z >= 1
       acosh!(z)
@@ -164,14 +173,6 @@
     end
   end
 
-  def asinh(z)
-    if z.real?
-      asinh!(z)
-    else
-      log(z + sqrt(1.0 + z * z))
-    end
-  end
-
   def atanh(z)
     if z.real? and z >= -1 and z <= 1
       atanh!(z)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]