Specifies what an
NSDecimal object will do when it encounters an error.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The method that was being executed when the error occurred.
The type of error that was generated.
The left operand.
The right operand.
There are four possible values for
error, described in
NSDecimal. The first three have to do with limits on the ability of
NSDecimal to represent decimal numbers. An
NSDecimal object can represent any number that can be expressed as mantissa x 10^exponent, where mantissa is a decimal integer up to 38 digits long, and exponent is between –256 and 256. The fourth results from the caller trying to divide by
exception, you can handle each of these errors in several ways:
Raise an exception. For an explanation of exceptions, see Exception Programming Topics.
nil. The calling method will return its value as though no error had occurred. If
Loss Of Precision
methodwill return an imprecise value—that is, one constrained to 38 significant digits. If
not. You shouldn’t return
Correct the error and return a valid
NSDecimalobject. The calling method will use this as its own return value.