The following XPath 2 numeric functions are available:
The abs function takes a numeric value as input and returns its absolute value as a decimal. For example, if the input argument is -2 or +2, the function returns 2.
The round-half-to-even function rounds the supplied number (first argument) to the degree of precision (number of decimal places) supplied in the optional second argument. For example, if the first argument is 2.141567 and the second argument is 3, then the first argument (the number) is rounded to three decimal places, so the result will be 2.141. If no precision (second argument) is supplied, the number is rounded to zero decimal places, that is, to an integer.
The 'even' in the name of the function refers to the rounding to an even number when a digit in the supplied number is midway between two values. For example, round-half-to-even(3.475, 2) would return 3.48.
© 2019 Altova GmbH