#import // // I did this in CodeRunner (https://coderunnerapp.com), which is super handy for tests like this. // int main(int argc, char *argv[]) { @autoreleasepool { NSString *maxDecimalAsString = [NSString stringWithFormat:@"%@", [NSDecimalNumber maximumDecimalNumber]]; NSLog(@"The maximum NSDecimalNumber is %@", maxDecimalAsString); // // max is known to be 3402823669209384634633746074317682114550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 // if we subtract 1... // NSString *knownMaxMinusOne = @"3402823669209384634633746074317682114549999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"; NSDecimalNumber *maxMinusOne = [NSDecimalNumber decimalNumberWithString:knownMaxMinusOne]; // // We end up with a number that quite different. The limit here is the mantissa supports accuracy to 38 places. // NSLog(@"Making an NSDecimalNumber 1 less than that (via an NSString) will be interpreted as %@", maxMinusOne); } }