summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/math.c b/math.c
index 24e52ba59c..6cef826812 100644
--- a/math.c
+++ b/math.c
@@ -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 */