XPath/XQuery log function

Summary

Returns the natural logarithm of the argument.

Signature

math:log(
$arg as xs:double?
) as xs:double?

Properties

This function is deterministic, context-independent, and focus-independent.

Rules

If $arg is the empty sequence, the function returns the empty sequence.

Otherwise the result is the natural logarithm of $arg, as defined in the specification of the log function applied to 64-bit binary floating point values.

Examples

The expression math:log(()) returns ().

The expression math:log(0) returns xs:double('-INF').

The expression math:log(math:exp(1)) returns 1.0e0.

The expression math:log(1.0e-3) returns -6.907755278982137e0.

The expression math:log(2) returns 0.6931471805599453e0.

The expression math:log(-1) returns xs:double('NaN').

The expression math:log(xs:double('NaN')) returns xs:double('NaN').

The expression math:log(xs:double('INF')) returns xs:double('INF').

The expression math:log(xs:double('-INF')) returns xs:double('NaN').

Notes

The treatment of divideByZero and invalidOperation exceptions is defined in . The effect is that if the argument is zero, the result is -INF, and if it is negative, the result is NaN .