op:float-divide

Divides $float-var1 by $float-var2. The div operator invokes the float-divide operator .

If the value of $float-var2 is equal to zero, the value of Infinity is returned. To learn more see Divide by Zero.

Signatures

op:float-divide(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 floating point value of dividing $float-var1 by $float-var2.

Examples

Simple

Invoking float-divide("4.4","2.2") returns the floating point value of 2.0 as shown in the following example query:

<float-divide>{op:float-divide("4.4","2.2")}</float-divide> 

The preceding query generates the following result:

<float-divide>2.0</float-divide> 

Divide by Zero

Invoking float-divide("2.2","0") returns the Infinity value as shown in the following example query:

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

The preceding query generates the following result:

<float-divide>Infinity</float-divide> 

To learn more see the IEEE Standard for Binary Floating-Point Arthimetic.

Related Topics

W3C float data type description.

W3C numeric-divide operator description.

IEEE Standard for Binary Floating-Point Arthimetic.