You have run into the maximum value that a NSDecimalNumber
can hold. There is a function which can tell you exactly what it is. Try:
NSLog(@"%@", [NSDecimalNumber maximumDecimalNumber]);
It will give you:
3402823669209384634633746074317682114550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Which happens to be 166 digits.
Objective-C/C does not support numbers larger than that, so you will need to use an Arbitrary Precision Math library. Here is another SO question which discusses some options.
EDIT:
Also, as Metabble mentions below, the maximum number of digits in the mantissa is 38 digits. This means that any calculation which results in a value larger than 38 digits will be truncated and stored with a mantissa keeping track of the number of remaining digits. When you access the results, every digit after the 38th one will be 0, which results in an incorrect value.