Rounds off the decimal value.


func NSDecimalRound(_ result: UnsafeMutablePointer<Decimal>, _ number: UnsafePointer<Decimal>, _ scale: Int, _ roundingMode: NSDecimalNumber.RoundingMode)


Rounds number off according to the parameters scale and roundingMode and stores the result in result.

The scale value specifies the number of digits result can have after its decimal point. roundingMode specifies the way that number is rounded off. There are four possible values for roundingMode: NSDecimalNumber.RoundingMode.down, NSDecimalNumber.RoundingMode.up, NSDecimalNumber.RoundingMode.plain, and NSDecimalNumber.RoundingMode.bankers. For thorough discussions of scale and roundingMode, see NSDecimalNumberBehaviors.

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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software