Skip to content
class method

Math.log

(::Math::double x, ?::Math::double base) -> ::Float
Math.log(x, base = Math::E) → Float

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
See also .lgamma .log10 .ldexp .log1p also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0