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

ruby-changes:19576

From: drbrain <ko1@a...>
Date: Wed, 18 May 2011 04:54:46 +0900 (JST)
Subject: [ruby-changes:19576] drbrain:r31617 (trunk): * lib/cmath.rb: Improve documentation. Patch by Jason Dew.

drbrain	2011-05-18 04:54:40 +0900 (Wed, 18 May 2011)

  New Revision: 31617

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

  Log:
    * lib/cmath.rb:  Improve documentation.  Patch by Jason Dew.
      [Ruby 1.9 - Feature #4717]

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31616)
+++ ChangeLog	(revision 31617)
@@ -1,3 +1,8 @@
+Wed May 18 04:53:41 2011  Eric Hodel  <drbrain@s...>
+
+	* lib/cmath.rb:  Improve documentation.  Patch by Jason Dew.
+	  [Ruby 1.9 - Feature #4717]
+
 Wed May 18 04:50:24 2011  Eric Hodel  <drbrain@s...>
 
 	* lib/net/ftp.rb:  Improve documentation.  Patch by Vincent Batts.
Index: lib/cmath.rb
===================================================================
--- lib/cmath.rb	(revision 31616)
+++ lib/cmath.rb	(revision 31617)
@@ -1,3 +1,6 @@
+##
+# Math functions for Complex numbers
+
 module CMath
 
   include Math
@@ -26,6 +29,8 @@
   alias acosh! acosh
   alias atanh! atanh
 
+  ##
+  # returns the value of e raised to the +z+ power
   def exp(z)
     if z.real?
       exp!(z)
@@ -36,6 +41,9 @@
     end
   end
 
+  ##
+  # returns the log of the first argument with the base
+  # optionally specified as the second argument
   def log(*args)
     z, b = args
     if z.real? and z >= 0 and (b.nil? or b >= 0)
@@ -49,6 +57,8 @@
     end
   end
 
+  ##
+  # returns the log base 2 of +z+
   def log2(z)
     if z.real? and z >= 0
       log2!(z)
@@ -57,6 +67,8 @@
     end
   end
 
+  ##
+  # returns the log base 10 of +z+
   def log10(z)
     if z.real? and z >= 0
       log10!(z)
@@ -65,6 +77,8 @@
     end
   end
 
+  ##
+  # returns the square root of +z+
   def sqrt(z)
     if z.real?
       if z < 0
@@ -84,6 +98,8 @@
     end
   end
 
+  ##
+  # returns the cube root of +z+
   def cbrt(z)
     if z.real?
       cbrt!(z)
@@ -92,6 +108,8 @@
     end
   end
 
+  ##
+  # returns the sine of +z+, where +z+ is given in radians
   def sin(z)
     if z.real?
       sin!(z)
@@ -101,6 +119,8 @@
     end
   end
 
+  ##
+  # returns the cosine of +z+, where +z+ is given in radians
   def cos(z)
     if z.real?
       cos!(z)
@@ -110,6 +130,8 @@
     end
   end
 
+  ##
+  # returns the tangent of +z+, where +z+ is given in radians
   def tan(z)
     if z.real?
       tan!(z)
@@ -118,6 +140,8 @@
     end
   end
 
+  ##
+  # returns the hyperbolic sine of +z+
   def sinh(z)
     if z.real?
       sinh!(z)
@@ -127,6 +151,8 @@
     end
   end
 
+  ##
+  # returns the hyperbolic cosine of +z+
   def cosh(z)
     if z.real?
       cosh!(z)
@@ -136,6 +162,8 @@
     end
   end
 
+  ##
+  # returns the hyperbolic tangent of +z+
   def tanh(z)
     if z.real?
       tanh!(z)
@@ -144,6 +172,8 @@
     end
   end
 
+  ##
+  # returns the arc sine of +z+
   def asin(z)
     if z.real? and z >= -1 and z <= 1
       asin!(z)
@@ -152,6 +182,8 @@
     end
   end
 
+  ##
+  # returns the arc cosine of +z+
   def acos(z)
     if z.real? and z >= -1 and z <= 1
       acos!(z)
@@ -160,6 +192,8 @@
     end
   end
 
+  ##
+  # returns the arc tangent of +z+
   def atan(z)
     if z.real?
       atan!(z)
@@ -168,6 +202,9 @@
     end
   end
 
+  ##
+  # returns the arc tangent of +y+ / +x+ using the signs
+  # of +y+ and +x+ to determine the quadrant
   def atan2(y,x)
     if y.real? and x.real?
       atan2!(y,x)
@@ -176,6 +213,8 @@
     end
   end
 
+  ##
+  # returns the inverse hyperbolic sine of +z+
   def asinh(z)
     if z.real?
       asinh!(z)
@@ -184,6 +223,8 @@
     end
   end
 
+  ##
+  # returns the inverse hyperbolic cosine of +z+
   def acosh(z)
     if z.real? and z >= 1
       acosh!(z)
@@ -192,6 +233,8 @@
     end
   end
 
+  ##
+  # returns the inverse hyperbolic tangent of +z+
   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/

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