ruby-changes:46796
From: nobu <ko1@a...>
Date: Sat, 27 May 2017 02:11:20 +0900 (JST)
Subject: [ruby-changes:46796] nobu:r58911 (trunk): numeric.c: remove duplicate code
nobu 2017-05-27 02:11:15 +0900 (Sat, 27 May 2017) New Revision: 58911 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58911 Log: numeric.c: remove duplicate code * numeric.c (flo_to_i): use dbl2ival and reduce duplicate code. Modified files: trunk/numeric.c Index: numeric.c =================================================================== --- numeric.c (revision 58910) +++ numeric.c (revision 58911) @@ -2324,16 +2324,11 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/numeric.c#L2324 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); } /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/