<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDecimalNormalize(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSDecimalNormalize"
  },
  "title" : "NSDecimalNormalize(_:_:_:)"
}
-->

# NSDecimalNormalize(_:_:_:)

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

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

## Discussion

[`Decimal`](/documentation/Foundation/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:

|Mantissa|Exponent|
|--------|--------|
|100     |0       |
|10      |1       |
|1       |2       |

Format `number1` and `number2` so that they have equal exponents. This format makes addition and subtraction very convenient. Both [`NSDecimalAdd(_:_:_:_:)`](/documentation/Foundation/NSDecimalAdd(_:_:_:_:)) and [`NSDecimalSubtract(_:_:_:_:)`](/documentation/Foundation/NSDecimalSubtract(_:_:_:_:)) call [`NSDecimalNormalize(_:_:_:)`](/documentation/Foundation/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(_:_:_:_:)`](/documentation/Foundation/NSDecimalAdd(_:_:_:_:)).

For more information, see [Number and Value Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/NumbersandValues/NumbersandValues.html#//apple_ref/doc/uid/10000038i).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)