diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-26 17:11:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-26 17:11:15 +0000 |
commit | 015d05c6e6e63104f5e9653663a6011684303cdf (patch) | |
tree | 8477da58a1c17ee72d2c4b61eee1bc43645dd6d2 | |
parent | 081b38fd48b1ac36824a40a9f237483b047623f0 (diff) |
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
-rw-r--r-- | numeric.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -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); } /* |