class method
Math.log
(::Math::double x, ?::Math::double base) -> ::Float
Math.log(x, base = Math::E) → Float
math.c
View on GitHub ↗
static VALUE
math_log(int argc, const VALUE *argv, VALUE unused_obj)
{
return rb_math_log(argc, argv);
}
Returns the base base logarithm of x.
-
Domain:
[0, INFINITY]. -
Range:
[-INFINITY, INFINITY)].
Examples:
Example
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