diff options
author | Yusuke Endoh <[email protected]> | 2023-09-13 19:21:52 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2023-09-13 21:40:05 +0900 |
commit | a0e66873053c2ce57a493294584da48ae600cafd (patch) | |
tree | 3a279f2f035e82214b464d9224018ba617204e03 /math.c | |
parent | 411572661a3995a0daacb6c866ea3ac6b52ad25b (diff) |
Use log2(b) instead of (log(b) / M_LN2)
Co-Authored-By: Nobuyoshi Nakada <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8429
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -538,6 +538,7 @@ math_log_split(VALUE x, size_t *numbits) # define log_intermediate log2 #else # define log_intermediate log10 +double log2(double x); #endif VALUE @@ -561,7 +562,7 @@ rb_math_log(int argc, const VALUE *argv) return DBL2NUM(-0.0); } d = log_intermediate(d) / log_intermediate(b); - d += (numbits - numbits_2) * M_LN2 / log(b); + d += (numbits - numbits_2) / log2(b); } else { /* check for pole error */ |