SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Notices
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
XPath API for Java
Saxon on .NET
Extensibility
Saxon Extensions
| Introduction
| EXSLT Extensions
| Extension attributes (XSLT only)
| Additional serialization parameters
» | Extension functions
| Extension instructions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# saxon:decimal-divide()

saxon:decimal-divide($arg1 as xs:decimal, $arg2 as decimal, $precision as integer) ==> xs:decimal

This performs a decimal division to a user-specified precision. The value of the first argument is divided by the second argument, and the result is returned to the number of decimal places indicated by the third argument. The exact result is rounded towards zero. For example, `decimal-divide(100, 30, 2)` returns 0.33. (The default for decimal division in Saxon using the `div` operator is to return max(18, s1, s2) decimal places in the result, where s1 is the scale of the first operand and s2 the scale of the second.)

Next