ruby-changes:53540
From: shyouhei <ko1@a...>
Date: Fri, 16 Nov 2018 13:05:58 +0900 (JST)
Subject: [ruby-changes:53540] shyouhei:r65756 (trunk): numeric.c: avoid division by zero
shyouhei 2018-11-16 13:05:53 +0900 (Fri, 16 Nov 2018) New Revision: 65756 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65756 Log: numeric.c: avoid division by zero Forgot to add in r65751. Modified files: trunk/numeric.c Index: numeric.c =================================================================== --- numeric.c (revision 65755) +++ numeric.c (revision 65756) @@ -3702,7 +3702,7 @@ static double https://github.com/ruby/ruby/blob/trunk/numeric.c#L3702 fix_fdiv_double(VALUE x, VALUE y) { if (FIXNUM_P(y)) { - return (double)FIX2LONG(x) / (double)FIX2LONG(y); + return double_div_double(FIX2LONG(x), FIX2LONG(y)); } else if (RB_TYPE_P(y, T_BIGNUM)) { return rb_big_fdiv_double(rb_int2big(FIX2LONG(x)), y); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/