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

ruby-changes:29235

From: zzak <ko1@a...>
Date: Thu, 13 Jun 2013 23:44:38 +0900 (JST)
Subject: [ruby-changes:29235] zzak:r41287 (trunk): * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn

zzak	2013-06-13 23:44:25 +0900 (Thu, 13 Jun 2013)

  New Revision: 41287

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

  Log:
    * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
    trunk/ext/bigdecimal/lib/bigdecimal/newton.rb
    trunk/ext/bigdecimal/sample/linear.rb
    trunk/ext/bigdecimal/sample/nlsolve.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41286)
+++ ChangeLog	(revision 41287)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 13 23:43:11 2013  Zachary Scott  <zachary@z...>
+
+	* ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
+
 Thu Jun 13 23:02:14 2013  Kouhei Sutou  <kou@c...>
 
 	* lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 41286)
+++ ext/bigdecimal/bigdecimal.c	(revision 41287)
@@ -890,17 +890,21 @@ BigDecimal_add(VALUE self, VALUE r) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L890
 }
 
  /* call-seq:
-  * sub(value, digits)
+  * value - digits   -> bigdecimal
   *
   * Subtract the specified value.
   *
   * e.g.
-  *   c = a.sub(b,n)
   *   c = a - b
   *
-  * digits:: If specified and less than the number of significant digits of the
-  * result, the result is rounded to that number of digits, according to
-  * BigDecimal.mode.
+  * The precision of the result value depends on the type of +b+.
+  *
+  * If +b+ is a Float, the precision of the result is Float::DIG+1.
+  *
+  * If +b+ is a BigDecimal, the precision of the result is +b+'s precision of
+  * internal representation from platform. So, it's return value is platform
+  * dependent.
+  *
   */
 static VALUE
 BigDecimal_sub(VALUE self, VALUE r)
@@ -1516,6 +1520,19 @@ BigDecimal_add2(VALUE self, VALUE b, VAL https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L1520
     }
 }
 
+/*
+ * sub(value, digits)  -> bigdecimal
+ *
+ * Subtract the specified value.
+ *
+ * e.g.
+ *   c = a.sub(b,n)
+ *
+ * digits:: If specified and less than the number of significant digits of the
+ * result, the result is rounded to that number of digits, according to
+ * BigDecimal.mode.
+ *
+ */
 static VALUE
 BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
 {
@@ -1533,6 +1550,7 @@ BigDecimal_sub2(VALUE self, VALUE b, VAL https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L1550
     }
 }
 
+
 static VALUE
 BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
 {
@@ -2492,6 +2510,7 @@ BigDecimal_new(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2510
     return VpAlloc(mf, RSTRING_PTR(iniValue));
 }
 
+/* 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 41286)
+++ ext/bigdecimal/sample/nlsolve.rb	(revision 41287)
@@ -9,7 +9,7 @@ require "bigdecimal" https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/nlsolve.rb#L9
 require "bigdecimal/newton"
 include Newton
 
-class Function
+class Function # :nodoc: all
   def initialize()
     @zero = BigDecimal::new("0.0")
     @one  = BigDecimal::new("1.0")
Index: ext/bigdecimal/sample/linear.rb
===================================================================
--- ext/bigdecimal/sample/linear.rb	(revision 41286)
+++ ext/bigdecimal/sample/linear.rb	(revision 41287)
@@ -10,6 +10,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/sample/linear.rb#L10
 #   ruby linear.rb [input file solved]
 #
 
+# :stopdoc:
 require "bigdecimal"
 require "bigdecimal/ludcmp"
 
Index: ext/bigdecimal/lib/bigdecimal/newton.rb
===================================================================
--- ext/bigdecimal/lib/bigdecimal/newton.rb	(revision 41286)
+++ ext/bigdecimal/lib/bigdecimal/newton.rb	(revision 41287)
@@ -30,7 +30,7 @@ module Newton https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/newton.rb#L30
   include Jacobian
   module_function
 
-  def norm(fv,zero=0.0)
+  def norm(fv,zero=0.0) # :nodoc:
     s = zero
     n = fv.size
     for i in 0...n do
@@ -39,6 +39,7 @@ module Newton https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/newton.rb#L39
     s
   end
 
+  # See also Newton
   def nlsolve(f,x)
     nRetry = 0
     n = x.size

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

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