Feature #10255 » math.c_ Math.log with base 0 or 1 should raise DomainError.PATCH
math.c | ||
---|---|---|
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);
|