summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/bigdecimal/bigdecimal.c29
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb3
-rw-r--r--ext/bigdecimal/sample/linear.rb1
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb2
5 files changed, 32 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 0510f95..7f12e0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jun 13 23:43:11 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
+
Thu Jun 13 23:02:14 2013 Kouhei Sutou <kou@cozmixng.org>
* lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 2a0aea8..95d74b9 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -890,17 +890,21 @@ BigDecimal_add(VALUE self, VALUE r)
}
/* 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, VALUE n)
}
}
+/*
+ * 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, VALUE n)
}
}
+
static VALUE
BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
{
@@ -2492,6 +2510,7 @@ BigDecimal_new(int argc, VALUE *argv)
return VpAlloc(mf, RSTRING_PTR(iniValue));
}
+/* See also BigDecimal::new */
static VALUE
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
{
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
index 1110652..db1a5ad 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -30,7 +30,7 @@ module Newton
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
s
end
+ # See also Newton
def nlsolve(f,x)
nRetry = 0
n = x.size
diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb
index 88a62ff..93d558b 100644
--- a/ext/bigdecimal/sample/linear.rb
+++ b/ext/bigdecimal/sample/linear.rb
@@ -10,6 +10,7 @@
# ruby linear.rb [input file solved]
#
+# :stopdoc:
require "bigdecimal"
require "bigdecimal/ludcmp"
diff --git a/ext/bigdecimal/sample/nlsolve.rb b/ext/bigdecimal/sample/nlsolve.rb
index 7f729e6..692a502 100644
--- a/ext/bigdecimal/sample/nlsolve.rb
+++ b/ext/bigdecimal/sample/nlsolve.rb
@@ -9,7 +9,7 @@ require "bigdecimal"
require "bigdecimal/newton"
include Newton
-class Function
+class Function # :nodoc: all
def initialize()
@zero = BigDecimal::new("0.0")
@one = BigDecimal::new("1.0")