diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-16 01:52:39 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-16 01:52:39 +0000 |
commit | 3a083985a471ca3d8429146f9f18dead6747c203 (patch) | |
tree | 90f05d31fb7a12e953dab7ff32e8554605c504d3 /vsnprintf.c | |
parent | a3b92a5d926cc9ec5d7f730e54eaa1aabe783a1f (diff) | |
download | ruby-3a083985a471ca3d8429146f9f18dead6747c203.tar.gz |
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
Diffstat (limited to 'vsnprintf.c')
-rw-r--r-- | vsnprintf.c | 2 |
1 files changed, 1 insertions, 1 deletions
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'; |