/*
 *  call-seq:
 *     Math.log(numeric)    => float
 *     Math.log(num,base)   => float
 *  
 *  Returns the natural logarithm of <i>numeric</i>.
 *  If additional second argument is given, it will be the base
 *  of logarithm.
 */

VALUE
math_log(int argc, VALUE *argv)
{
    VALUE x, base;
    double d;

    rb_scan_args(argc, argv, "11", &x, &base);
    Need_Float(x);
    errno = 0;
    d = log(RFLOAT_VALUE(x));
    if (!NIL_P(base)) {
        Need_Float(base);
        d /= log(RFLOAT_VALUE(base));
    }
    domain_check(d, "log");
    return DOUBLE2NUM(d);
}