summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-28 05:11:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-28 05:11:44 +0000
commit99431e7355cadb97049d54bcffe5aeb2ba1c8a47 (patch)
treedd2dde25eb59bf16ec35daee60446b3ce4267e27 /numeric.c
parenta4a551f85658c90de5723b9d0f7e06c87a0e6378 (diff)
downloadruby-99431e7355cadb97049d54bcffe5aeb2ba1c8a47.tar.gz
numeric.c: float overflow
* numeric.c (ruby_num_interval_step_size): get rid of float conversion overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 9692be96ce..d8f2c3470c 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1836,7 +1836,8 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
double n = ruby_float_step_size(NUM2DBL(from), NUM2DBL(to), NUM2DBL(step), excl);
if (isinf(n)) return DBL2NUM(n);
- return LONG2FIX(n);
+ if (POSFIXABLE(n)) return LONG2FIX(n);
+ return rb_dbl2big(n);
}
else {
VALUE result;