I've come across an error when converting Int.max
to a double then back to integer:
print(Int(Double(Int.max)))
and getting the following error:
Fatal error: Double value cannot be converted to Int because the result would be greater than Int.max
I'd be appreciated if you can explain me the the reason of the above error. Is it something related to floating point arithmetic?
Tested this on Swift 4.2.