[NSDecimalNumber integerValue] gives incorrect results

Originator:m
Number:rdar://18257823 Date Originated:07-Sep-2014
Status:Closed Resolved:
Product:iOS SDK Product Version:8.0
Classification:Crash/Hang/Data Loss Reproducible:Yes
 
Summary:
[NSDecimalNumber integerValue] gives incorrect results, when the mantissa is large, whereas "intValue" is correct.

Similarly, "unsignedIntegerValue" is incorrect and "insignedIntValue" is correct.

Steps to Reproduce:
NSLog(@"%ld", (long)[[NSDecimalNumber decimalNumberWithString:@"344.514533996581994496"] integerValue]);

Expected Results:
344

Actual Results:
-5

Comments

UPDATE Closed as a duplicate of 19433878


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!