class method
Math.log10
(::Math::double x) -> ::Float
Math.log10(x) → float
math.c
View on GitHub ↗
static VALUE
math_log10(VALUE unused_obj, VALUE x)
{
size_t numbits;
double d = get_double_rshift(x, &numbits);
domain_check_min(d, 0.0, "log10");
/* check for pole error */
if (d == 0.0) return DBL2NUM(-HUGE_VAL);
return DBL2NUM(log10(d) + numbits * log10(2)); /* log10(d * 2 ** numbits) */
}
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