aboutsummaryrefslogtreecommitdiffstats
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-12 09:36:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-12 09:36:52 +0000
commit4e28fdf417fcd2d9492277b46a556264ab9ba0de (patch)
treeffcea426128a06fc8382471729cf1416385ed11d /object.c
parent62c17a2f21b47243071075cbef37fe72b6ecd0ff (diff)
downloadruby-4e28fdf417fcd2d9492277b46a556264ab9ba0de.tar.gz
No FloatDomainError at non-finitive number if exception: false
[ruby-core:91021] [Bug #15525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/object.c b/object.c
index af8f8aee38..9029dad99c 100644
--- a/object.c
+++ b/object.c
@@ -3159,6 +3159,7 @@ rb_convert_to_integer(VALUE val, int base, int raise_exception)
double f;
if (base != 0) goto arg_error;
f = RFLOAT_VALUE(val);
+ if (!raise_exception && !isfinite(f)) return Qnil;
if (FIXABLE(f)) return LONG2FIX((long)f);
return rb_dbl2big(f);
}