fn:divide-decimals

Divides one xs:decimal by another to a defined precision, returning both the quotient and the remainder.

divide-decimals($value as xs:decimal, $divisor as xs:decimal, $precision as xs:integer?:=0) ➔ record(quotient as xs:decimal, remainder as xs:decimal)

Arguments

 

$value

xs:decimal

The decimal number to be divided

 

$divisor

xs:decimal

The number to divide by

 

$precision

xs:integer?

:= 0

The required precision

Result

record(quotient as xs:decimal, remainder as xs:decimal)

Namespace

http://www.w3.org/2005/xpath-functions

Links to W3C specifications

XPath 4.0 Functions and Operators

Saxon availability

Available in XPath 4.0, XSLT 4.0, and XQuery 4.0. Requires Saxon-PE or Saxon-EE. Implemented since Saxon 13. Available for all platforms.

Notes on the Saxon implementation

The 4.0 specification states that the limits on precision are implementation-defined. Saxon requires the precision to be in the range -100 to +100; a requested precision outside this range is adjusted to -100 or +100 as appropriate.