# fn:round-half-to-even

fn:round-half-to-even(numeric? $srcval) → numeric?

Function signature

$srcval | numeric ?
Result | numeric ?

Rounds a numeric value to the nearest whole number, rounding x.5 towards the nearest even number.

XPath 2.0 Specification

fn:round-half-to-even(numeric? $srcval, integer $precision) → numeric?

Function signature

$srcval | numeric ?
$precision | xs:integer
Result | numeric ?

Rounds a numeric value to the nearest integer multiple of 10 the power of minus precision, rounding x.5 towards the nearest number whose last digit is even.

XPath 2.0 Specification

Note:In the case of doubles and floats, rounding errors may occur giving unexpected effects.

Expand | Up Next