Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

Math.log10

(::Math::double x) -> ::Float
Math.log10(x) → float

Returns the base 10 logarithm of x.

  • Domain: [0, INFINITY].

  • Range: [-INFINITY, INFINITY].

Examples:

Example
log10(0.0)      # => -Infinity
log10(1.0)      # => 0.0
log10(10.0)     # => 1.0
log10(INFINITY) # => Infinity
See also .log .log1p .lgamma .log2 also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0