From 3a083985a471ca3d8429146f9f18dead6747c203 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Fri, 16 Nov 2018 01:52:39 +0000 Subject: avoid division by zero * cvt(): use signbit() instead of 1/d < 0 * w_float(): ditto * ruby_float_step_size(): unit==0 check shall be prior to divisions * arith_seq_float_step_size(): ditto * rb_big_divide(): same as r65642 * fix_divide(): ditto * rb_big_fdiv_double(): ditto * fix_fdiv_double(): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vsnprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vsnprintf.c') diff --git a/vsnprintf.c b/vsnprintf.c index d221e757bf..04184d7a6a 100644 --- a/vsnprintf.c +++ b/vsnprintf.c @@ -1250,7 +1250,7 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch, int *l if (value < 0) { value = -value; *sign = '-'; - } else if (value == 0.0 && 1.0/value < 0) { + } else if (value == 0.0 && signbit(value)) { *sign = '-'; } else { *sign = '\000'; -- cgit v1.2.3