Round to the closest allowed value; if two values are equally close, the even one is chosen.
- Xcode 8.0+
- Swift Standard Library
This rounding rule is also known as “bankers rounding,” and is the default IEEE 754 rounding mode for arithmetic. The following example shows the results of rounding numbers using this rule:
This rule implements the
round operation defined by the IEEE 754 specification.