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

ruby-changes:43280

From: usa <ko1@a...>
Date: Fri, 10 Jun 2016 16:09:05 +0900 (JST)
Subject: [ruby-changes:43280] usa:r55354 (ruby_2_2): merge revision(s) 55123, 55129, 55130, 55133, 55136: [Backport #12414]

usa	2016-06-10 16:09:00 +0900 (Fri, 10 Jun 2016)

  New Revision: 55354

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55354

  Log:
    merge revision(s) 55123,55129,55130,55133,55136: [Backport #12414]
    
    * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
      non-finite float values not to raise FloatDomainError.
      [ruby-core:75682] [Bug #12414]
    
    * ext/bigdecimal/bigdecimal.c (isfinite): isfinite does not always
      exist.  fixed build error on Windows itroduced at r55123.
      exist.  fixed build error on Windows introduced at r55123.
    
    * ext/bigdecimal/bigdecimal.c (isfinite): get rid of a warning on
      cygwin. [Bug #12417][ruby-core:75691]
    
    * include/ruby/missing.h (isfinite): move from numeric.c.

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/ext/bigdecimal/bigdecimal.c
    branches/ruby_2_2/include/ruby/missing.h
    branches/ruby_2_2/numeric.c
    branches/ruby_2_2/test/bigdecimal/test_bigdecimal.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/include/ruby/missing.h
===================================================================
--- ruby_2_2/include/ruby/missing.h	(revision 55353)
+++ ruby_2_2/include/ruby/missing.h	(revision 55354)
@@ -171,6 +171,13 @@ RUBY_EXTERN int isnan(double); https://github.com/ruby/ruby/blob/trunk/ruby_2_2/include/ruby/missing.h#L171
 # endif
 #endif
 
+#ifndef isfinite
+# ifndef HAVE_ISFINITE
+#   define HAVE_ISFINITE 1
+#   define isfinite(x) finite(x)
+# endif
+#endif
+
 #ifndef HAVE_NEXTAFTER
 RUBY_EXTERN double nextafter(double x, double y);
 #endif
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 55353)
+++ ruby_2_2/ChangeLog	(revision 55354)
@@ -1,3 +1,23 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Jun 10 16:06:25 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* include/ruby/missing.h (isfinite): move from numeric.c.
+
+Fri Jun 10 16:06:25 2016  NAKAMURA Usaku  <usa@r...>
+
+	* ext/bigdecimal/bigdecimal.c (isfinite): get rid of a warning on
+	  cygwin. [Bug #12417][ruby-core:75691]
+
+Fri Jun 10 16:06:25 2016  NAKAMURA Usaku  <usa@r...>
+
+	* ext/bigdecimal/bigdecimal.c (isfinite): isfinite does not always
+	  exist.  fixed build error on Windows introduced at r55123.
+
+Fri Jun 10 16:06:25 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
+	  non-finite float values not to raise FloatDomainError.
+	  [ruby-core:75682] [Bug #12414]
+
 Fri Jun 10 16:00:27 2016  NAKAMURA Usaku  <usa@r...>
 
 	* thread.c (recursive_list_access): a object id may be a Bignum.  so,
Index: ruby_2_2/test/bigdecimal/test_bigdecimal.rb
===================================================================
--- ruby_2_2/test/bigdecimal/test_bigdecimal.rb	(revision 55353)
+++ ruby_2_2/test/bigdecimal/test_bigdecimal.rb	(revision 55354)
@@ -458,6 +458,18 @@ class TestBigDecimal < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/bigdecimal/test_bigdecimal.rb#L458
     assert_equal(false, BigDecimal.new("NaN") > n1)
   end
 
+  def test_cmp_float_nan
+    assert_equal(nil, BigDecimal.new("1") <=> Float::NAN)
+  end
+
+  def test_cmp_float_pos_inf
+    assert_equal(-1, BigDecimal.new("1") <=> Float::INFINITY)
+  end
+
+  def test_cmp_float_neg_inf
+    assert_equal(+1, BigDecimal.new("1") <=> -Float::INFINITY)
+  end
+
   def test_cmp_failing_coercion
     n1 = BigDecimal.new("1")
     assert_equal(nil, n1 <=> nil)
Index: ruby_2_2/ext/bigdecimal/bigdecimal.c
===================================================================
--- ruby_2_2/ext/bigdecimal/bigdecimal.c	(revision 55353)
+++ ruby_2_2/ext/bigdecimal/bigdecimal.c	(revision 55354)
@@ -215,6 +215,12 @@ again: https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/bigdecimal/bigdecimal.c#L215
 	if (prec < 0) goto unable_to_coerce_without_prec;
 	if (prec > DBL_DIG+1) goto SomeOneMayDoIt;
 	d = RFLOAT_VALUE(v);
+	if (!isfinite(d)) {
+	    pv = VpCreateRbObject(prec, NULL);
+	    pv->sign = isnan(d) ? VP_SIGN_NaN :
+		d > 0 ? VP_SIGN_POSITIVE_INFINITE : VP_SIGN_NEGATIVE_FINITE;
+	    return pv;
+	}
 	if (d != 0.0) {
 	    v = rb_funcall(v, id_to_r, 0);
 	    goto again;
Index: ruby_2_2/numeric.c
===================================================================
--- ruby_2_2/numeric.c	(revision 55353)
+++ ruby_2_2/numeric.c	(revision 55354)
@@ -28,14 +28,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/numeric.c#L28
 #include <ieeefp.h>
 #endif
 
-#if !defined HAVE_ISFINITE && !defined isfinite
-#if defined HAVE_FINITE && !defined finite && !defined _WIN32
-extern int finite(double);
-# define HAVE_ISFINITE 1
-# define isfinite(x) finite(x)
-#endif
-#endif
-
 /* use IEEE 64bit values if not defined */
 #ifndef FLT_RADIX
 #define FLT_RADIX 2
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 55353)
+++ ruby_2_2/version.h	(revision 55354)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.6"
 #define RUBY_RELEASE_DATE "2016-06-10"
-#define RUBY_PATCHLEVEL 329
+#define RUBY_PATCHLEVEL 330
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 6

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55123,55129-55130,55133,55136


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

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