op:float-mod

Return the remainder of dividing $float-var1 by $float-var2. The mod operator invokes the float-mod operator.

To learn more about using this operator with NaN, positive infinity, or negative infinity operands, see the W3C numeric-mod operator description.

Signatures

op:float-mod(xs:float $float-var1, xs:float $float-var2) —> xs:float

Arguments

Data Type
Argument
Description

xs:float

$float-var1

Represents a 32 bit floating point number, for example: 1.1.

xs:float

$float-var2

Represents a 32 bit floating point number, for example: 1.1.

Returns

Returns the remainder of dividing $float-var1 by $float-var2.

Examples

Simple

Invoking float-mod("1.25","1.0") returns the floating point value: .25 because 1.25 divided by 1.0 results in 1 with the remainder: .25. The remainder: .25 is returned as shown in the following example query:

<float-mod>{op:float-mod("1.25","1.0")}</float-mod> 

The preceding query generates the following result:

<float-mod>0.25</float-mod> 

Divide by Zero

Invoking float-mod("2.2","0")returns a NaN (Not a Number) value as shown in the following example query:

<float-mod>{op:float-mod("2.2","0")}</float-mod> 

The preceding query generates the following result:

<float-mod>NaN</float-mod> 

Related Topics

W3C float data type description.

W3C numeric-mod operator description.