Protocol

NSDecimalNumberBehaviors

The NSDecimalBehaviors protocol declares three methods that control the discretionary aspects of working with NSDecimalNumber objects.

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.

Symbols

Rounding

func roundingMode()
Required.

Returns the way that NSDecimalNumber's decimalNumberBy... methods round their return values.

func scale()
Required.

Returns the number of digits allowed after the decimal separator.

Handling errors

Constants

RoundingMode

These constants specify rounding behaviors.

CalculationError

Calculation error constants used to describe an error in exceptionDuringOperation(_:error:leftOperand:rightOperand:).

Relationships