beetlebug▾
/

tcl::mathfunc log10

Gives the logarithm of a number to the base 10.

tcl::mathfunc::log10 NUMBER
expr {log10(NUMBER)}

Description

Gives the logarithm of NUMBER to the base 10. log10(0) is -Inf, and a negative number is a domain error.

Arguments

ArgumentTypeDefaultDescription
NUMBERnumberrequiredA number, 0 or more.

Returns

A float.

Examples

% expr {log10(1000)}
3.0

% expr {log10(0.001)}
-3.0

Errors

% expr {log10(-1)}
domain error: argument not in valid range
-errorcode ARITH DOMAIN {domain error: argument not in valid range}

# Tcl 9.1 only
% expr {log10("x")}
cannot use non-numeric string "x" as operand of "log10"
-errorcode ARITH DOMAIN {non-numeric string}

# Tcl 8.6 only
% expr {log10("x")}
can't use non-numeric string as operand of "log10"
-errorcode ARITH DOMAIN {non-numeric string}

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also