ruby-changes:43371
From: nagachika <ko1@a...>
Date: Sun, 19 Jun 2016 04:49:26 +0900 (JST)
Subject: [ruby-changes:43371] nagachika:r55445 (ruby_2_3): merge revision(s) 55123, 55129, 55130, 55133, 55136: [Backport #12414]
nagachika 2016-06-19 04:48:54 +0900 (Sun, 19 Jun 2016) New Revision: 55445 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55445 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 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_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/ext/bigdecimal/bigdecimal.c branches/ruby_2_3/include/ruby/missing.h branches/ruby_2_3/numeric.c branches/ruby_2_3/test/bigdecimal/test_bigdecimal.rb branches/ruby_2_3/version.h Index: ruby_2_3/ext/bigdecimal/bigdecimal.c =================================================================== --- ruby_2_3/ext/bigdecimal/bigdecimal.c (revision 55444) +++ ruby_2_3/ext/bigdecimal/bigdecimal.c (revision 55445) @@ -239,6 +239,12 @@ again: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L239 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_3/numeric.c =================================================================== --- ruby_2_3/numeric.c (revision 55444) +++ ruby_2_3/numeric.c (revision 55445) @@ -28,14 +28,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/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_3/version.h =================================================================== --- ruby_2_3/version.h (revision 55444) +++ ruby_2_3/version.h (revision 55445) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" -#define RUBY_RELEASE_DATE "2016-06-16" -#define RUBY_PATCHLEVEL 132 +#define RUBY_RELEASE_DATE "2016-06-19" +#define RUBY_PATCHLEVEL 133 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 16 +#define RUBY_RELEASE_DAY 19 #include "ruby/version.h" Index: ruby_2_3/test/bigdecimal/test_bigdecimal.rb =================================================================== --- ruby_2_3/test/bigdecimal/test_bigdecimal.rb (revision 55444) +++ ruby_2_3/test/bigdecimal/test_bigdecimal.rb (revision 55445) @@ -459,6 +459,18 @@ class TestBigDecimal < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/bigdecimal/test_bigdecimal.rb#L459 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_3/include/ruby/missing.h =================================================================== --- ruby_2_3/include/ruby/missing.h (revision 55444) +++ ruby_2_3/include/ruby/missing.h (revision 55445) @@ -174,6 +174,13 @@ RUBY_EXTERN int isnan(double); https://github.com/ruby/ruby/blob/trunk/ruby_2_3/include/ruby/missing.h#L174 # 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_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 55444) +++ ruby_2_3/ChangeLog (revision 55445) @@ -1,3 +1,23 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Sun Jun 19 04:29:13 2016 Nobuyoshi Nakada <nobu@r...> + + * include/ruby/missing.h (isfinite): move from numeric.c. + +Sun Jun 19 04:29:13 2016 NAKAMURA Usaku <usa@r...> + + * ext/bigdecimal/bigdecimal.c (isfinite): get rid of a warning on + cygwin. [Bug #12417][ruby-core:75691] + +Sun Jun 19 04:29:13 2016 NAKAMURA Usaku <usa@r...> + + * ext/bigdecimal/bigdecimal.c (isfinite): isfinite does not always + exist. fixed build error on Windows introduced at r55123. + +Sun Jun 19 04:29:13 2016 Nobuyoshi Nakada <nobu@r...> + + * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider + non-finite float values not to raise FloatDomainError. + [ruby-core:75682] [Bug #12414] + Thu Jun 16 00:42:56 2016 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_modify_expand): check integer overflow. Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55123,55129-55130,55133,55136 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/