Method: Math#log

Defined in:
math.c

#log(x, base = Math::E) ⇒ Float (private)

Returns the base base logarithm of x.

  • Domain: [0, INFINITY].

  • Range: [-INFINITY, INFINITY)].

Examples:

log(0.0)        # => -Infinity
log(1.0)        # => 0.0
log(E)          # => 1.0
log(INFINITY)   # => Infinity

log(0.0, 2.0)   # => -Infinity
log(1.0, 2.0)   # => 0.0
log(2.0, 2.0)   # => 1.0

log(0.0, 10.0)  # => -Infinity
log(1.0, 10.0)  # => 0.0
log(10.0, 10.0) # => 1.0

Returns:



505
506
507
508
509
# File 'math.c', line 505

static VALUE
math_log(int argc, const VALUE *argv, VALUE unused_obj)
{
    return rb_math_log(argc, argv);
}