---
title: NSDecimalNumberBehaviors
framework: foundation
role: symbol
role_heading: Protocol
path: foundation/nsdecimalnumberbehaviors
---

# NSDecimalNumberBehaviors

A protocol that declares three methods that control the discretionary aspects of working with decimal numbers.

## Declaration

```swift
protocol NSDecimalNumberBehaviors
```

## Overview

Overview The scale() and roundingMode() methods determine the precision of NSDecimalNumber’s return values and the way in which those values should be rounded to fit that precision. The exceptionDuringOperation(_:error:leftOperand:rightOperand:) method determines the way in which an NSDecimalNumber object should handle different calculation errors. For an example of a class that adopts the NSDecimalBehaviors protocol, see the specification for NSDecimalNumberHandler.

## Topics

### Rounding

- [roundingMode()](foundation/nsdecimalnumberbehaviors/roundingmode().md)
- [scale()](foundation/nsdecimalnumberbehaviors/scale().md)

### Handling errors

- [exceptionDuringOperation(_:error:leftOperand:rightOperand:)](foundation/nsdecimalnumberbehaviors/exceptionduringoperation(_:error:leftoperand:rightoperand:).md)

### Constants

- [NSDecimalNumber.RoundingMode](foundation/nsdecimalnumber/roundingmode.md)
- [NSDecimalNumber.CalculationError](foundation/nsdecimalnumber/calculationerror.md)

## Relationships

### Conforming Types

- [NSDecimalNumberHandler](foundation/nsdecimalnumberhandler.md)

## See Also

### Managing Behavior

- [defaultBehavior](foundation/nsdecimalnumber/defaultbehavior.md)
- [NSDecimalNumberHandler](foundation/nsdecimalnumberhandler.md)
