ruby-changes:30978
From: zzak <ko1@a...>
Date: Thu, 26 Sep 2013 22:14:05 +0900 (JST)
Subject: [ruby-changes:30978] zzak:r43057 (trunk): * ext/bigdecimal/bigdecimal.c: [DOC] several fixes by @chastell
zzak 2013-09-26 22:13:59 +0900 (Thu, 26 Sep 2013) New Revision: 43057 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43057 Log: * 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 Modified files: trunk/ChangeLog trunk/ext/bigdecimal/bigdecimal.c Index: ChangeLog =================================================================== --- ChangeLog (revision 43056) +++ ChangeLog (revision 43057) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Sep 26 22:11:56 2013 Zachary Scott <e@z...> + + * 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@z...> * lib/observer.rb: [DOC] syntax improvement in example by @chastell Index: ext/bigdecimal/bigdecimal.c =================================================================== --- ext/bigdecimal/bigdecimal.c (revision 43056) +++ ext/bigdecimal/bigdecimal.c (revision 43057) @@ -449,10 +449,10 @@ check_rounding_mode(VALUE const v) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L449 * 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) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L598 } /* 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, https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2552 * 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: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2957 * 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: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2967 * 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: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2988 * 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: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L3009 * 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) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L3152 * 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. */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/