diff options
author | Yusuke Endoh <[email protected]> | 2023-09-13 18:56:24 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2023-09-13 21:40:05 +0900 |
commit | 411572661a3995a0daacb6c866ea3ac6b52ad25b (patch) | |
tree | 377a8f96e33f6a412df37d8315c168b01f0ab5fb /math.c | |
parent | 4655d2108ef14e66f64496f9029f65ba2302d9ea (diff) |
math.c: Fix Math.log against huge bignum [Bug #19878]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8429
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -561,14 +561,14 @@ rb_math_log(int argc, const VALUE *argv) return DBL2NUM(-0.0); } d = log_intermediate(d) / log_intermediate(b); - numbits -= numbits_2; + d += (numbits - numbits_2) * M_LN2 / log(b); } else { /* check for pole error */ if (d == 0.0) return DBL2NUM(-HUGE_VAL); d = log(d); + d += numbits * M_LN2; } - d += numbits * M_LN2; return DBL2NUM(d); } |