math:acos

Returns the arc cosine of the argument.

Signature

math:acos($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 arc cosine of $arg, as defined in the [IEEE 754-2008] specification of the acos function applied to 64-bit binary floating point values. The result is in the range zero to +π radians.

Notes

The treatment of the invalidOperation exception is defined in Arithmetic operators on numeric values.

If $arg is NaN, or if its absolute value is greater than one, then the result is NaN.

In other cases the result is an xs:double value representing an angle θ in radians in the range 0 <= θ <= +π.

Examples

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

The expression math:acos(0) returns 1.5707963267948966e0 (approximately).

The expression math:acos(-0.0e0) returns 1.5707963267948966e0 (approximately).

The expression math:acos(1.0e0) returns 0.0e0.

The expression math:acos(-1.0e0) returns 3.141592653589793e0 (approximately).

The expression math:acos(2.0e0) returns xs:double('NaN').

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

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

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