From 0a619ef7efdaa8001bb4a9b028e2b35174ce66bb Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 10 Jun 2016 07:09:00 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/bigdecimal/bigdecimal.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ext') diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 11a7109635..b4166ae376 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -215,6 +215,12 @@ again: 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; -- cgit v1.2.3