summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-26 17:11:15 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-26 17:11:15 (GMT)
commit015d05c6e6e63104f5e9653663a6011684303cdf (patch)
tree8477da58a1c17ee72d2c4b61eee1bc43645dd6d2 /numeric.c
parent081b38fd48b1ac36824a40a9f237483b047623f0 (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
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 8205829..be4b729 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);
}
/*