aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-26 17:11:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-26 17:11:15 +0000
commita68946a094b50ad27e4e44c63c477d941eb3b305 (patch)
tree8477da58a1c17ee72d2c4b61eee1bc43645dd6d2 /numeric.c
parentc6d50fb68ce18d8739220c45f05a32d517237252 (diff)
downloadruby-a68946a094b50ad27e4e44c63c477d941eb3b305.tar.gz
numeric.c: remove duplicate code
* numeric.c (flo_to_i): use dbl2ival and reduce duplicate code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/numeric.c b/numeric.c
index 8205829f8d..be4b729904 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2324,16 +2324,11 @@ static VALUE
flo_to_i(VALUE num)
{
double f = RFLOAT_VALUE(num);
- long val;
if (f > 0.0) f = floor(f);
if (f < 0.0) f = ceil(f);
- if (!FIXABLE(f)) {
- return rb_dbl2big(f);
- }
- val = (long)f;
- return LONG2FIX(val);
+ return dbl2ival(f);
}
/*