ruby-changes:43539
From: nobu <ko1@a...>
Date: Fri, 8 Jul 2016 14:38:20 +0900 (JST)
Subject: [ruby-changes:43539] nobu:r55612 (trunk): numeric.c: round as double
nobu 2016-07-08 14:38:16 +0900 (Fri, 08 Jul 2016) New Revision: 55612 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55612 Log: numeric.c: round as double * numeric.c (flo_round): compare as double, not long double with i387. Modified files: trunk/numeric.c Index: numeric.c =================================================================== --- numeric.c (revision 55611) +++ numeric.c (revision 55612) @@ -2007,10 +2007,10 @@ flo_round(int argc, VALUE *argv, VALUE n https://github.com/ruby/ruby/blob/trunk/numeric.c#L2007 f = pow(10, ndigits); x = round(number * f); if (x > 0) { - if ((x + 0.5) / f <= number) x += 1; + if ((double)((x + 0.5) / f) <= number) x += 1; } else { - if ((x - 0.5) / f >= number) x -= 1; + if ((double)((x - 0.5) / f) >= number) x -= 1; } return DBL2NUM(x / f); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/