NSDecimalNumber unsignedIntegerValue conversions are ... surprising

Originator:geoffrey.wiseman
Number:rdar://26551762 Date Originated:2016-05-31
Status:Closed Resolved:
Product:iOS Product Version:9.3
Classification:Other Bug Reproducible:Always
 
Summary:
If you have an NSDecimalNumber representing a real number with a large mantissa, like 89.857142857142857142857142857142857142, and then you convert it to an unsigned integer value, you may get '0' as the result, instead of '89' or '90', either of which would be much less surprising.

Steps to Reproduce:
NSDecimalNumber(string:"89.857142857142857142857142857142857142").unsignedIntegerValue

Expected Results:
89 (or 90)

Actual Results:
0

Comments

Duplicate of 18661697

"Engineering has determined that your bug report (26551762) is a duplicate of another issue (18661697) and will be closed."

By geoffrey.wiseman at June 28, 2016, 1:55 p.m. (reply...)

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!