Hmm, I actually thought about this being the reason but couldn't remember the 
limits.

And thought that i would receive a overflows when stored into 'Float' error...?

> 5. okt. 2016 kl. 19.26 skrev Jens Alfke <[email protected]>:
> 
> 
>> On Oct 5, 2016, at 2:30 AM, Lars-Jørgen Kristiansen via swift-users 
>> <[email protected] <mailto:[email protected]>> wrote:
>> 
>> // Also noticed this:
>> "\(floatNumber)" // "1e+07"
>> "\(doubleNumer)" // "10000000"
> 
> Numbers around 10 million are too large to be represented exactly by a 32-bit 
> float — the mantissa is 24 bits, including sign, so its range is ±8.3 
> million. (The specific number 10,000,000 does come out exactly, though, since 
> it’s a multiple of 128.) 
> 
> So even if Float.description did use non-scientific notation for numbers at 
> this scale, they wouldn’t be accurate. In fact the implementor of the 
> .description method may have decided intentionally to switch to scientific 
> notation at this scale so that the number of significant figures can be 
> limited to the available precision.
> 
> —Jens

_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to