summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/math.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/math.c b/src/math.c
index 48180a98f..1de9c0d8f 100644
--- a/src/math.c
+++ b/src/math.c
@@ -411,11 +411,14 @@ math_exp(mrb_state *mrb, mrb_value obj)
static mrb_value
math_log(mrb_state *mrb, mrb_value obj)
{
- mrb_float x;
+ mrb_float x, base;
+ int argc;
- mrb_get_args(mrb, "f", &x);
+ argc = mrb_get_args(mrb, "f|f", &x, &base);
x = log(x);
-
+ if (argc == 2) {
+ d /= log(base);
+ }
return mrb_float_value(x);
}