---
title: FloatingPointRoundingRule.towardZero
framework: swift
role: symbol
role_heading: Case
path: swift/floatingpointroundingrule/towardzero
---

# FloatingPointRoundingRule.towardZero

Round to the closest allowed value whose magnitude is less than or equal to that of the source.

## Declaration

```swift
case towardZero
```

## Discussion

Discussion The following example shows the results of rounding numbers using this rule: (5.2).rounded(.towardZero) // 5.0 (5.5).rounded(.towardZero) // 5.0 (-5.2).rounded(.towardZero) // -5.0 (-5.5).rounded(.towardZero) // -5.0 This rule is equivalent to the C trunc function and implements the roundToIntegralTowardZero operation defined by the IEEE 754 specification.
