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

ruby-changes:32632

From: naruse <ko1@a...>
Date: Mon, 27 Jan 2014 16:57:07 +0900 (JST)
Subject: [ruby-changes:32632] naruse:r44711 (ruby_2_1): merge revision(s) 44588: [Backport #9316]

naruse	2014-01-27 16:56:58 +0900 (Mon, 27 Jan 2014)

  New Revision: 44711

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

  Log:
    merge revision(s) 44588: [Backport #9316]
    
    * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Add an additional
      digit for the quotient to be compatible with bigdecimal 1.2.1 and
      the former.  [ruby-core:59365] [#9316] [#9305]
    
    * test/bigdecimal/test_bigdecimal.rb: tests for the above change.
    
    * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.4.

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/ext/bigdecimal/bigdecimal.c
    branches/ruby_2_1/ext/bigdecimal/bigdecimal.gemspec
    branches/ruby_2_1/test/bigdecimal/test_bigdecimal.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 44710)
+++ ruby_2_1/ChangeLog	(revision 44711)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Jan 27 16:49:52 2014  Kenta Murata  <mrkn@m...>
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Add an additional
+	  digit for the quotient to be compatible with bigdecimal 1.2.1 and
+	  the former.  [ruby-core:59365] [#9316] [#9305]
+
+	* test/bigdecimal/test_bigdecimal.rb: tests for the above change.
+
+	* ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.4.
+
 Mon Jan 27 16:45:34 2014  Yamashita Yuu  <yamashita@g...>
 
 	* ext/openssl/ossl_ssl.c (Init_ossl_ssl): Declare a constant
Index: ruby_2_1/ext/bigdecimal/bigdecimal.c
===================================================================
--- ruby_2_1/ext/bigdecimal/bigdecimal.c	(revision 44710)
+++ ruby_2_1/ext/bigdecimal/bigdecimal.c	(revision 44711)
@@ -1221,8 +1221,10 @@ BigDecimal_divide(Real **c, Real **res, https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/bigdecimal/bigdecimal.c#L1221
 
     *div = b;
     mx = a->Prec + vabs(a->exponent);
-    if (mx<b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
-    mx =(mx + 1) * VpBaseFig();
+    if (mx < b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
+    mx++; /* NOTE: An additional digit is needed for the compatibility to
+                   the version 1.2.1 and the former.  */
+    mx = (mx + 1) * VpBaseFig();
     GUARD_OBJ((*c), VpCreateRbObject(mx, "#0"));
     GUARD_OBJ((*res), VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
     VpDivd(*c, *res, a, b);
Index: ruby_2_1/ext/bigdecimal/bigdecimal.gemspec
===================================================================
--- ruby_2_1/ext/bigdecimal/bigdecimal.gemspec	(revision 44710)
+++ ruby_2_1/ext/bigdecimal/bigdecimal.gemspec	(revision 44711)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/bigdecimal/bigdecimal.gemspec#L1
 # -*- ruby -*-
-_VERSION = "1.2.3"
+_VERSION = "1.2.4"
 date = %w$Date::                           $[1]
 
 Gem::Specification.new do |s|
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 44710)
+++ ruby_2_1/version.h	(revision 44711)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.1"
 #define RUBY_RELEASE_DATE "2014-01-27"
-#define RUBY_PATCHLEVEL 9
+#define RUBY_PATCHLEVEL 10
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_1/test/bigdecimal/test_bigdecimal.rb
===================================================================
--- ruby_2_1/test/bigdecimal/test_bigdecimal.rb	(revision 44710)
+++ ruby_2_1/test/bigdecimal/test_bigdecimal.rb	(revision 44711)
@@ -701,6 +701,10 @@ class TestBigDecimal < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/bigdecimal/test_bigdecimal.rb#L701
     assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, (BigDecimal.new("-0") / 1).sign)
     assert_equal(2, BigDecimal.new("2") / 1)
     assert_equal(-2, BigDecimal.new("2") / -1)
+
+    assert_equal(BigDecimal('1486.868686869'), BigDecimal('1472.0') / BigDecimal('0.99'), '[ruby-core:59365] [#9316]')
+
+    assert_equal(4.124045235, BigDecimal('0.9932') / (700 * BigDecimal('0.344045') / BigDecimal('1000.0')), '[#9305]')
   end
 
   def test_div_with_float

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44588


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

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