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

ruby-changes:29681

From: nagachika <ko1@a...>
Date: Tue, 2 Jul 2013 03:10:13 +0900 (JST)
Subject: [ruby-changes:29681] nagachika:r41733 (ruby_2_0_0): merge revision(s) 41623,41723: [Backport #6862] [Backport #8587]

nagachika	2013-07-02 03:09:58 +0900 (Tue, 02 Jul 2013)

  New Revision: 41733

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

  Log:
    merge revision(s) 41623,41723: [Backport #6862] [Backport #8587]
    
    * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix for the cases when
      the argument x is not a BigDecimal.
      This change is based on the patch made by Garth Snyder.
      [Fix GH-332] https://github.com/ruby/ruby/pull/332
      This change is based on the patch made by Heesob Park and Garth Snyder.
      [Bug #6862] [ruby-core:47145]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/ext/bigdecimal/bigdecimal.c
    branches/ruby_2_0_0/test/bigdecimal/test_bigdecimal.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41732)
+++ ruby_2_0_0/ChangeLog	(revision 41733)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue Jul  2 03:06:38 2013  Kenta Murata  <mrkn@m...>
+
+	* ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Fix for the cases when
+	  the argument x is not a BigDecimal.
+	  This change is based on the patch made by Heesob Park and Garth Snyder.
+	  [Bug #6862] [ruby-core:47145]
+	  [Fix GH-332] https://github.com/ruby/ruby/pull/332
+
 Fri Jun 28 02:20:13 2013  Aman Gupta  <ruby@t...>
 
 	* compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().
Index: ruby_2_0_0/ext/bigdecimal/bigdecimal.c
===================================================================
--- ruby_2_0_0/ext/bigdecimal/bigdecimal.c	(revision 41732)
+++ ruby_2_0_0/ext/bigdecimal/bigdecimal.c	(revision 41733)
@@ -2689,7 +2689,7 @@ BigMath_s_exp(VALUE klass, VALUE x, VALU https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ext/bigdecimal/bigdecimal.c#L2689
     else if (vx == NULL) {
 	cannot_be_coerced_into_BigDecimal(rb_eArgError, x);
     }
-    RB_GC_GUARD(vx->obj);
+    x = RB_GC_GUARD(vx->obj);
 
     n = prec + rmpd_double_figures();
     negative = VpGetSign(vx) < 0;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41732)
+++ ruby_2_0_0/version.h	(revision 41733)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-06-28"
-#define RUBY_PATCHLEVEL 248
+#define RUBY_RELEASE_DATE "2013-07-02"
+#define RUBY_PATCHLEVEL 249
 
 #define RUBY_RELEASE_YEAR 2013
-#define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 28
+#define RUBY_RELEASE_MONTH 7
+#define RUBY_RELEASE_DAY 2
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/bigdecimal/test_bigdecimal.rb
===================================================================
--- ruby_2_0_0/test/bigdecimal/test_bigdecimal.rb	(revision 41732)
+++ ruby_2_0_0/test/bigdecimal/test_bigdecimal.rb	(revision 41733)
@@ -1276,11 +1276,35 @@ class TestBigDecimal < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/bigdecimal/test_bigdecimal.rb#L1276
   end
 
   def test_BigMath_exp
-    n = 20
-    assert_in_epsilon(Math.exp(n), BigMath.exp(BigDecimal("20"), n))
-    assert_in_epsilon(Math.exp(40), BigMath.exp(BigDecimal("40"), n))
-    assert_in_epsilon(Math.exp(-n), BigMath.exp(BigDecimal("-20"), n))
-    assert_in_epsilon(Math.exp(-40), BigMath.exp(BigDecimal("-40"), n))
+    prec = 20
+    assert_in_epsilon(Math.exp(20), BigMath.exp(BigDecimal("20"), prec))
+    assert_in_epsilon(Math.exp(40), BigMath.exp(BigDecimal("40"), prec))
+    assert_in_epsilon(Math.exp(-20), BigMath.exp(BigDecimal("-20"), prec))
+    assert_in_epsilon(Math.exp(-40), BigMath.exp(BigDecimal("-40"), prec))
+  end
+
+  def test_BigMath_exp_with_float
+    prec = 20
+    assert_in_epsilon(Math.exp(20), BigMath.exp(20.0, prec))
+    assert_in_epsilon(Math.exp(40), BigMath.exp(40.0, prec))
+    assert_in_epsilon(Math.exp(-20), BigMath.exp(-20.0, prec))
+    assert_in_epsilon(Math.exp(-40), BigMath.exp(-40.0, prec))
+  end
+
+  def test_BigMath_exp_with_fixnum
+    prec = 20
+    assert_in_epsilon(Math.exp(20), BigMath.exp(20, prec))
+    assert_in_epsilon(Math.exp(40), BigMath.exp(40, prec))
+    assert_in_epsilon(Math.exp(-20), BigMath.exp(-20, prec))
+    assert_in_epsilon(Math.exp(-40), BigMath.exp(-40, prec))
+  end
+
+  def test_BigMath_exp_with_rational
+    prec = 20
+    assert_in_epsilon(Math.exp(20), BigMath.exp(Rational(40,2), prec))
+    assert_in_epsilon(Math.exp(40), BigMath.exp(Rational(80,2), prec))
+    assert_in_epsilon(Math.exp(-20), BigMath.exp(Rational(-40,2), prec))
+    assert_in_epsilon(Math.exp(-40), BigMath.exp(Rational(-80,2), prec))
   end
 
   def test_BigMath_exp_under_gc_stress

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r41623,41723


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

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