diff --git a/math.c b/math.c index 849d822..e05980b 100644 --- a/math.c +++ b/math.c @@ -459,11 +459,14 @@ static VALUE math_log(int argc, const VALUE *argv, VALUE obj) { VALUE x, base; - double d; + double d0, d; rb_scan_args(argc, argv, "11", &x, &base); d = math_log1(x); if (argc == 2) { + Need_Float(base); + d0 = RFLOAT_VALUE(base); + if (d0 == 0.0 || d0 == 1.0) domain_error("log"); d /= math_log1(base); } return DBL2NUM(d);