Enumeration Case

FloatingPointRoundingRule.up

Round to the closest allowed value that is greater than or equal to the source.

Declaration

case up

Discussion

The following example shows the results of rounding numbers using this rule:

(5.2).rounded(.up)
// 6.0
(5.5).rounded(.up)
// 6.0
(-5.2).rounded(.up)
// -5.0
(-5.5).rounded(.up)
// -5.0

This rule is equivalent to the C ceil function and implements the roundToIntegralTowardPositive operation defined by the IEEE 754 specification.