From 91a665905a8781373480f003c2e15cef9fa3604c Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Thu, 14 Jun 2012 00:41:33 +0900 Subject: Math.log to take optinal second argument --- src/math.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3