[swift-users] Very large NSNumber values

Rien Rien at Balancingrock.nl
Mon Jun 26 07:03:04 CDT 2017


I was working with very large NSNumber values and noticed some odd behaviour when converting these values to integers.

An NSNumber with the value +1e+40 will when converted to Ints produce integers wit the value zero for Int8, UInt8, Int16, UInt16, Int32 and UInt32.
But for Int64 it will produce Int64.min
And for UInt64 it will produce UInt64.max

It would seem to me that it would be better if the behaviour were consistent for all conversions.

Worthy of a bug report?


Regards,
Rien

Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Balancingrock
Project: http://swiftfire.nl - An HTTP(S) web server framework in Swift









More information about the swift-users mailing list