---
title: "NSDecimalNormalize(_:_:_:)"
framework: foundation
role: symbol
role_heading: Function
path: "foundation/nsdecimalnormalize(_:_:_:)"
---

# NSDecimalNormalize(_:_:_:)

Normalizes the internal format of two decimal numbers to simplify later operations.

## Declaration

```swift
func NSDecimalNormalize(_ number1: UnsafeMutablePointer<Decimal>, _ number2: UnsafeMutablePointer<Decimal>, _ roundingMode: NSDecimalNumber.RoundingMode) -> NSDecimalNumber.CalculationError
```

## Discussion

Discussion Decimal instances are represented in memory as a mantissa and an exponent, expressing the value mantissa x 10^exponent. A number can have many representations; for example, the following table lists several valid representations for the number 100:  |   |   |   |  Format number1 and number2 so that they have equal exponents. This format makes addition and subtraction very convenient. Both NSDecimalAdd(_:_:_:_:) and NSDecimalSubtract(_:_:_:_:) call NSDecimalNormalize(_:_:_:). You may want to use it if you write more complicated addition or subtraction routines. For explanations of the possible return values, see NSDecimalAdd(_:_:_:_:). For more information, see Number and Value Programming Topics.

## See Also

### Performing arithmetic using references

- [NSDecimalCompact(_:)](foundation/nsdecimalcompact(_:).md)
- [NSDecimalAdd(_:_:_:_:)](foundation/nsdecimaladd(_:_:_:_:).md)
- [NSDecimalSubtract(_:_:_:_:)](foundation/nsdecimalsubtract(_:_:_:_:).md)
- [NSDecimalDivide(_:_:_:_:)](foundation/nsdecimaldivide(_:_:_:_:).md)
- [NSDecimalMultiply(_:_:_:_:)](foundation/nsdecimalmultiply(_:_:_:_:).md)
- [NSDecimalMultiplyByPowerOf10(_:_:_:_:)](foundation/nsdecimalmultiplybypowerof10(_:_:_:_:).md)
- [NSDecimalRound(_:_:_:_:)](foundation/nsdecimalround(_:_:_:_:).md)
- [NSDecimalPower(_:_:_:_:)](foundation/nsdecimalpower(_:_:_:_:).md)
- [Decimal.RoundingMode](foundation/decimal/roundingmode.md)
- [NSDecimalNumber.RoundingMode](foundation/nsdecimalnumber/roundingmode.md)
- [Decimal.CalculationError](foundation/decimal/calculationerror.md)
- [NSDecimalNumber.CalculationError](foundation/nsdecimalnumber/calculationerror.md)
