Enumeration Case


Round to the closest allowed value; if two values are equally close, the even one is chosen.


case toNearestOrEven


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:

// 5.0
// 6.0
// 4.0

This rule implements the roundToIntegralTiesToEven operation defined by the IEEE 754 specification.