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 /marshal.c | |
parent | a3b92a5d926cc9ec5d7f730e54eaa1aabe783a1f (diff) |
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 'marshal.c')
-rw-r--r-- | marshal.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -401,8 +401,8 @@ w_float(double d, struct dump_arg *arg) w_cstr("nan", arg); } else if (d == 0.0) { - if (1.0/d < 0) w_cstr("-0", arg); - else w_cstr("0", arg); + if (signbit(d)) w_cstr("-0", arg); + else w_cstr("0", arg); } else { int decpt, sign, digs, len = 0; |