math:sin

Returns the sine of the argument. The argument is an angle in radians.

Signature

math:sin( as xs:double?) as xs:double?

Properties

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

Rules

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

Otherwise the result is the sine of $θ (which is treated as an angle in radians) as defined in the [IEEE 754-2008] specification of the sin function applied to 64-bit binary floating point values.

Notes

The treatment of the invalidOperation and underflow exceptions is defined in Arithmetic operators on numeric values.

If $θ is positive or negative zero, the result is $θ.

If $θ is positive or negative infinity, or NaN, then the result is NaN.

Otherwise the result is always in the range -1.0e0 to +1.0e0

Examples

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

The expression math:sin(0) returns 0.0e0.

The expression math:sin(-0.0e0) returns -0.0e0.

The expression math:sin(math:pi() div 2) returns 1.0e0 (approximately).

The expression math:sin(-math:pi() div 2) returns -1.0e0 (approximately).

The expression math:sin(math:pi()) returns 0.0e0 (approximately).

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

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

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