Divides one decimal value by another.


func NSDecimalDivide(_ result: UnsafeMutablePointer<Decimal>, _ leftOperand: UnsafePointer<Decimal>, _ rightOperand: UnsafePointer<Decimal>, _ roundingMode: NSDecimalNumber.RoundingMode) -> NSDecimalNumber.CalculationError


Divides leftOperand by rightOperand and stores the quotient, possibly rounded off according to roundingMode, in result. If rightOperand is 0, returns NSDivideByZero.

For explanations of the possible return values and rounding modes, see NSDecimalAdd(_:_:_:_:).

Note that repeating decimals or numbers with a mantissa larger than 38 digits cannot be represented precisely.

For more information, see Number and Value Programming Topics.

See Also

Performing Arithmetic Using References

func NSDecimalCompact(UnsafeMutablePointer<Decimal>)

Compacts the decimal structure for efficiency.

typealias Decimal.RoundingMode

An alias for an enumeration that specifies possible rounding modes.

enum NSDecimalNumber.RoundingMode

These constants specify rounding behaviors.

typealias Decimal.CalculationError

An alias for a type that specifies possible calculation errors.