Very large NSNumber values


(Rien) #1

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