1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c: [DOC] several fixes by @chastell

This includes fixing the capitalization of Infinity, return value of
  example "BigDecimal.new('NaN') == 0.0", and code style in example.
  [Fixes GH-398] https://github.com/ruby/ruby/pull/398


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2013-09-26 13:13:59 +00:00
parent 327cd07708
commit 8603fdcc62
2 changed files with 21 additions and 14 deletions

View file

@ -1,3 +1,10 @@
Thu Sep 26 22:11:56 2013 Zachary Scott <e@zzak.io>
* ext/bigdecimal/bigdecimal.c: [DOC] several fixes by @chastell
This includes fixing the capitalization of Infinity, return value of
example "BigDecimal.new('NaN') == 0.0", and code style in example.
[Fixes GH-398] https://github.com/ruby/ruby/pull/398
Thu Sep 26 22:08:11 2013 Zachary Scott <e@zzak.io>
* lib/observer.rb: [DOC] syntax improvement in example by @chastell

View file

@ -449,10 +449,10 @@ check_rounding_mode(VALUE const v)
* When computation continues, results are as follows:
*
* EXCEPTION_NaN:: NaN
* EXCEPTION_INFINITY:: +infinity or -infinity
* EXCEPTION_INFINITY:: +Infinity or -Infinity
* EXCEPTION_UNDERFLOW:: 0
* EXCEPTION_OVERFLOW:: +infinity or -infinity
* EXCEPTION_ZERODIVIDE:: +infinity or -infinity
* EXCEPTION_OVERFLOW:: +Infinity or -Infinity
* EXCEPTION_ZERODIVIDE:: +Infinity or -Infinity
*
* One value of the mode parameter controls the rounding of numeric values:
* BigDecimal::ROUND_MODE. The values it can take are:
@ -598,7 +598,7 @@ BigDecimal_IsNaN(VALUE self)
}
/* Returns nil, -1, or +1 depending on whether the value is finite,
* -infinity, or +infinity.
* -Infinity, or +Infinity.
*/
static VALUE
BigDecimal_IsInfinite(VALUE self)
@ -2552,8 +2552,8 @@ BigDecimal_limit(int argc, VALUE *argv, VALUE self)
* BigDecimal::SIGN_NaN:: value is Not a Number
* BigDecimal::SIGN_POSITIVE_ZERO:: value is +0
* BigDecimal::SIGN_NEGATIVE_ZERO:: value is -0
* BigDecimal::SIGN_POSITIVE_INFINITE:: value is +infinity
* BigDecimal::SIGN_NEGATIVE_INFINITE:: value is -infinity
* BigDecimal::SIGN_POSITIVE_INFINITE:: value is +Infinity
* BigDecimal::SIGN_NEGATIVE_INFINITE:: value is -Infinity
* BigDecimal::SIGN_POSITIVE_FINITE:: value is positive
* BigDecimal::SIGN_NEGATIVE_FINITE:: value is negative
*/
@ -2957,7 +2957,7 @@ get_vp_value:
* For example, try:
*
* sum = 0
* for i in (1..10000)
* 10_000.times do
* sum = sum + 0.0001
* end
* print sum #=> 0.9999999999999062
@ -2967,7 +2967,7 @@ get_vp_value:
* require 'bigdecimal'
*
* sum = BigDecimal.new("0")
* for i in (1..10000)
* 10_000.times do
* sum = sum + BigDecimal.new("0.0001")
* end
* print sum #=> 0.1E1
@ -2988,8 +2988,8 @@ get_vp_value:
* BigDecimal sometimes needs to return infinity, for example if you divide
* a value by zero.
*
* BigDecimal.new("1.0") / BigDecimal.new("0.0") #=> infinity
* BigDecimal.new("-1.0") / BigDecimal.new("0.0") #=> -infinity
* BigDecimal.new("1.0") / BigDecimal.new("0.0") #=> Infinity
* BigDecimal.new("-1.0") / BigDecimal.new("0.0") #=> -Infinity
*
* You can represent infinite numbers to BigDecimal using the strings
* <code>'Infinity'</code>, <code>'+Infinity'</code> and
@ -3009,8 +3009,8 @@ get_vp_value:
* NaN is never considered to be the same as any other value, even NaN itself:
*
* n = BigDecimal.new('NaN')
* n == 0.0 #=> nil
* n == n #=> nil
* n == 0.0 #=> false
* n == n #=> false
*
* === Positive and negative zero
*
@ -3152,10 +3152,10 @@ Init_bigdecimal(void)
* See BigDecimal.mode.
*/
rb_define_const(rb_cBigDecimal, "ROUND_HALF_DOWN", INT2FIX(VP_ROUND_HALF_DOWN));
/* 5: Round towards +infinity. See BigDecimal.mode. */
/* 5: Round towards +Infinity. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_CEILING", INT2FIX(VP_ROUND_CEIL));
/* 6: Round towards -infinity. See BigDecimal.mode. */
/* 6: Round towards -Infinity. See BigDecimal.mode. */
rb_define_const(rb_cBigDecimal, "ROUND_FLOOR", INT2FIX(VP_ROUND_FLOOR));
/* 7: Round towards the even neighbor. See BigDecimal.mode. */