---
title: "rounding(accordingToBehavior:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsdecimalnumber/rounding(accordingtobehavior:)"
---

# rounding(accordingToBehavior:)

Returns a rounded version of the decimal number using the specified rounding behavior.

## Declaration

```swift
func rounding(accordingToBehavior behavior: (any NSDecimalNumberBehaviors)?) -> NSDecimalNumber
```

## Discussion

Discussion For a description of the different ways of rounding, see the roundingMode method in the NSDecimalNumberBehaviors protocol specification.
