mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/bigdecimal/*: improve documentation, nodoc samples with @mrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2b83a57fcb
commit
51c43dba6a
5 changed files with 32 additions and 7 deletions
|
@ -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>
|
Thu Jun 13 23:02:14 2013 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
|
* lib/xmlrpc/client.rb (XMLRPC::Client#http): Add reader for raw
|
||||||
|
|
|
@ -890,17 +890,21 @@ BigDecimal_add(VALUE self, VALUE r)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call-seq:
|
/* call-seq:
|
||||||
* sub(value, digits)
|
* value - digits -> bigdecimal
|
||||||
*
|
*
|
||||||
* Subtract the specified value.
|
* Subtract the specified value.
|
||||||
*
|
*
|
||||||
* e.g.
|
* e.g.
|
||||||
* c = a.sub(b,n)
|
|
||||||
* c = a - b
|
* c = a - b
|
||||||
*
|
*
|
||||||
* digits:: If specified and less than the number of significant digits of the
|
* The precision of the result value depends on the type of +b+.
|
||||||
* result, the result is rounded to that number of digits, according to
|
*
|
||||||
* BigDecimal.mode.
|
* 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
|
static VALUE
|
||||||
BigDecimal_sub(VALUE self, VALUE r)
|
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
|
static VALUE
|
||||||
BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
|
BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
|
||||||
{
|
{
|
||||||
|
@ -1533,6 +1550,7 @@ BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
|
BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
|
||||||
{
|
{
|
||||||
|
@ -2492,6 +2510,7 @@ BigDecimal_new(int argc, VALUE *argv)
|
||||||
return VpAlloc(mf, RSTRING_PTR(iniValue));
|
return VpAlloc(mf, RSTRING_PTR(iniValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See also BigDecimal::new */
|
||||||
static VALUE
|
static VALUE
|
||||||
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
|
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Newton
|
||||||
include Jacobian
|
include Jacobian
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def norm(fv,zero=0.0)
|
def norm(fv,zero=0.0) # :nodoc:
|
||||||
s = zero
|
s = zero
|
||||||
n = fv.size
|
n = fv.size
|
||||||
for i in 0...n do
|
for i in 0...n do
|
||||||
|
@ -39,6 +39,7 @@ module Newton
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# See also Newton
|
||||||
def nlsolve(f,x)
|
def nlsolve(f,x)
|
||||||
nRetry = 0
|
nRetry = 0
|
||||||
n = x.size
|
n = x.size
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# ruby linear.rb [input file solved]
|
# ruby linear.rb [input file solved]
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# :stopdoc:
|
||||||
require "bigdecimal"
|
require "bigdecimal"
|
||||||
require "bigdecimal/ludcmp"
|
require "bigdecimal/ludcmp"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ require "bigdecimal"
|
||||||
require "bigdecimal/newton"
|
require "bigdecimal/newton"
|
||||||
include Newton
|
include Newton
|
||||||
|
|
||||||
class Function
|
class Function # :nodoc: all
|
||||||
def initialize()
|
def initialize()
|
||||||
@zero = BigDecimal::new("0.0")
|
@zero = BigDecimal::new("0.0")
|
||||||
@one = BigDecimal::new("1.0")
|
@one = BigDecimal::new("1.0")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue