NSDecimalAdd(_:_:_:_:)
Adds two decimal values.
Declaration
func NSDecimalAdd(_ result: UnsafeMutablePointer<Decimal>, _ leftOperand: UnsafePointer<Decimal>, _ rightOperand: UnsafePointer<Decimal>, _ roundingMode: NSDecimalNumber.RoundingMode) -> NSDecimalNumber.CalculationErrorDiscussion
Adds leftOperand to rightOperand and stores the sum in result. Decimal instances can represent a number with up to 38 significant digits. If a number is more precise than that, it must be rounded off. roundingMode determines how to round it off. There are four possible rounding modes:
The return value indicates whether any machine limitations were encountered in the addition. If none were encountered, the function returns NSCalculationNoError. Otherwise it may return one of the following values: NSCalculationLossOfPrecision, NSCalculationOverflow or NSCalculationUnderflow. For descriptions of all these error conditions, see exceptionDuringOperation(_:error:leftOperand:rightOperand:) in NSDecimalNumberBehaviors.
For more information, see Number and Value Programming Topics.
See Also
Performing arithmetic using references
NSDecimalCompact(_:)NSDecimalSubtract(_:_:_:_:)NSDecimalDivide(_:_:_:_:)NSDecimalMultiply(_:_:_:_:)NSDecimalMultiplyByPowerOf10(_:_:_:_:)NSDecimalRound(_:_:_:_:)NSDecimalPower(_:_:_:_:)NSDecimalNormalize(_:_:_:)Decimal.RoundingModeNSDecimalNumber.RoundingModeDecimal.CalculationErrorNSDecimalNumber.CalculationError