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

ruby-changes:32407

From: eregon <ko1@a...>
Date: Fri, 3 Jan 2014 00:10:20 +0900 (JST)
Subject: [ruby-changes:32407] eregon:r44486 (trunk): * ext/bigdecimal: update class method call style from :: to .

eregon	2014-01-03 00:10:13 +0900 (Fri, 03 Jan 2014)

  New Revision: 44486

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

  Log:
    * ext/bigdecimal: update class method call style from :: to .
      in documentation and usage.
    * ext/bigdecimal/lib/bigdecimal/math.rb: [DOC] fix examples values.
      Computations were made using ruby 2.0.0p247 to ensure
      no effect of the recent BigDecimal bug.
    * ext/bigdecimal/sample/nlsolve.rb: fix indent.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
    trunk/ext/bigdecimal/lib/bigdecimal/jacobian.rb
    trunk/ext/bigdecimal/lib/bigdecimal/math.rb
    trunk/ext/bigdecimal/sample/linear.rb
    trunk/ext/bigdecimal/sample/nlsolve.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44485)
+++ ChangeLog	(revision 44486)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jan  3 00:09:54 2014  Benoit Daloze  <eregontp@g...>
+
+	* ext/bigdecimal: update class method call style from :: to .
+	  in documentation and usage.
+
+	* ext/bigdecimal/lib/bigdecimal/math.rb: [DOC] fix examples values.
+	  Computations were made using ruby 2.0.0p247 to ensure
+	  no effect of the recent BigDecimal bug.
+
+	* ext/bigdecimal/sample/nlsolve.rb: fix indent.
+
 Thu Jan  2 16:07:21 2014  Masaki Matsushita  <glass.saga@g...>
 
 	* io.c (io_fwrite): freeze converted str.
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 44485)
+++ ext/bigdecimal/bigdecimal.c	(revision 44486)
@@ -2531,7 +2531,7 @@ BigDecimal_new(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2531
     return VpAlloc(mf, RSTRING_PTR(iniValue));
 }
 
-/* See also BigDecimal::new */
+/* See also BigDecimal.new */
 static VALUE
 BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
 {
Index: ext/bigdecimal/sample/nlsolve.rb
===================================================================
--- ext/bigdecimal/sample/nlsolve.rb	(revision 44485)
+++ ext/bigdecimal/sample/nlsolve.rb	(revision 44486)
@@ -11,11 +11,11 @@ include Newton https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/nlsolve.rb#L11
 
 class Function # :nodoc: all
   def initialize()
-    @zero = BigDecimal::new("0.0")
-    @one  = BigDecimal::new("1.0")
-    @two  = BigDecimal::new("2.0")
-    @ten  = BigDecimal::new("10.0")
-    @eps  = BigDecimal::new("1.0e-16")
+    @zero = BigDecimal.new("0.0")
+    @one  = BigDecimal.new("1.0")
+    @two  = BigDecimal.new("2.0")
+    @ten  = BigDecimal.new("10.0")
+    @eps  = BigDecimal.new("1.0e-16")
   end
   def zero;@zero;end
   def one ;@one ;end
@@ -31,8 +31,9 @@ class Function # :nodoc: all https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/nlsolve.rb#L31
     f
   end
 end
- f = BigDecimal::limit(100)
- f = Function.new
- x = [f.zero,f.zero]      # Initial values
- n = nlsolve(f,x)
- p x
+
+f = BigDecimal.limit(100)
+f = Function.new
+x = [f.zero,f.zero]      # Initial values
+n = nlsolve(f,x)
+p x
Index: ext/bigdecimal/sample/linear.rb
===================================================================
--- ext/bigdecimal/sample/linear.rb	(revision 44485)
+++ ext/bigdecimal/sample/linear.rb	(revision 44486)
@@ -16,8 +16,8 @@ require "bigdecimal/ludcmp" https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/linear.rb#L16
 
 #
 # NOTE:
-#   Change following BigDecimal::limit() if needed.
-BigDecimal::limit(100)
+#   Change following BigDecimal.limit() if needed.
+BigDecimal.limit(100)
 #
 
 include LUSolve
@@ -27,8 +27,8 @@ def rd_order(na) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/linear.rb#L27
 end
 
 na   = ARGV.size
-zero = BigDecimal::new("0.0")
-one  = BigDecimal::new("1.0")
+zero = BigDecimal.new("0.0")
+one  = BigDecimal.new("1.0")
 
 while (n=rd_order(na))>0
   a = []
@@ -40,10 +40,10 @@ while (n=rd_order(na))>0 https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/linear.rb#L40
      for i in 0...n do
        for j in 0...n do
          printf("A[%d,%d]? ",i,j); s = ARGF.gets
-         a  << BigDecimal::new(s);
-         as << BigDecimal::new(s);
+         a  << BigDecimal.new(s);
+         as << BigDecimal.new(s);
        end
-       printf("Contatant vector element b[%d] ? ",i); b << BigDecimal::new(ARGF.gets);
+       printf("Contatant vector element b[%d] ? ",i); b << BigDecimal.new(ARGF.gets);
      end
   else
      # Read data from specified file.
@@ -53,10 +53,10 @@ while (n=rd_order(na))>0 https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/linear.rb#L53
        printf("%d) %s",i,s)
        s = s.split
        for j in 0...n do
-         a  << BigDecimal::new(s[j]);
-         as << BigDecimal::new(s[j]);
+         a  << BigDecimal.new(s[j]);
+         as << BigDecimal.new(s[j]);
        end
-       b << BigDecimal::new(s[n]);
+       b << BigDecimal.new(s[n]);
      end
   end
   x = lusolve(a,b,ludecomp(a,n,zero,one),zero)
Index: ext/bigdecimal/lib/bigdecimal/jacobian.rb
===================================================================
--- ext/bigdecimal/lib/bigdecimal/jacobian.rb	(revision 44485)
+++ ext/bigdecimal/lib/bigdecimal/jacobian.rb	(revision 44486)
@@ -75,7 +75,7 @@ module Jacobian https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/jacobian.rb#L75
   # Computes the Jacobian of f at x. fx is the value of f at x.
   def jacobian(f,fx,x)
     n = x.size
-    dfdx = Array::new(n*n)
+    dfdx = Array.new(n*n)
     for i in 0...n do
       df = dfdxi(f,fx,x,i)
       for j in 0...n do
Index: ext/bigdecimal/lib/bigdecimal/math.rb
===================================================================
--- ext/bigdecimal/lib/bigdecimal/math.rb	(revision 44485)
+++ ext/bigdecimal/lib/bigdecimal/math.rb	(revision 44486)
@@ -36,8 +36,8 @@ module BigMath https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/math.rb#L36
   # Computes the square root of +decimal+ to the specified number of digits of
   # precision, +numeric+.
   #
-  #   BigMath::sqrt(BigDecimal.new('2'), 16).to_s
-  #   #=> "0.14142135623730950488016887242096975E1"
+  #   BigMath.sqrt(BigDecimal.new('2'), 16).to_s
+  #   #=> "0.1414213562373095048801688724E1"
   #
   def sqrt(x, prec)
     x.sqrt(prec)
@@ -51,7 +51,7 @@ module BigMath https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/math.rb#L51
   #
   # If +decimal+ is Infinity or NaN, returns NaN.
   #
-  #   BigMath::sin(BigMath::PI(5)/4, 5).to_s
+  #   BigMath.sin(BigMath.PI(5)/4, 5).to_s
   #   #=> "0.70710678118654752440082036563292800375E0"
   #
   def sin(x, prec)
@@ -95,7 +95,7 @@ module BigMath https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/math.rb#L95
   #
   # If +decimal+ is Infinity or NaN, returns NaN.
   #
-  #   BigMath::cos(BigMath::PI(4), 16).to_s
+  #   BigMath.cos(BigMath.PI(4), 16).to_s
   #   #=> "-0.999999999999999999999999999999856613163740061349E0"
   #
   def cos(x, prec)
@@ -139,7 +139,7 @@ module BigMath https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/math.rb#L139
   #
   # If +decimal+ is NaN, returns NaN.
   #
-  #   BigMath::atan(BigDecimal.new('-1'), 16).to_s
+  #   BigMath.atan(BigDecimal.new('-1'), 16).to_s
   #   #=> "-0.785398163397448309615660845819878471907514682065E0"
   #
   def atan(x, prec)
@@ -176,7 +176,7 @@ module BigMath https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/math.rb#L176
   # Computes the value of pi to the specified number of digits of precision,
   # +numeric+.
   #
-  #   BigMath::PI(10).to_s
+  #   BigMath.PI(10).to_s
   #   #=> "0.3141592653589793238462643388813853786957412E1"
   #
   def PI(prec)
@@ -221,7 +221,7 @@ module BigMath https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/math.rb#L221
   # Computes e (the base of natural logarithms) to the specified number of
   # digits of precision, +numeric+.
   #
-  #   BigMath::E(10).to_s
+  #   BigMath.E(10).to_s
   #   #=> "0.271828182845904523536028752390026306410273E1"
   #
   def E(prec)

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

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