Try this:
(float)100008009
And you will probably get
100008008
The issue is that we get no warning. And this can't be overflow since floats can take higher values. So I can't explain this result.
Try this:
(float)100008009
And you will probably get
100008008
The issue is that we get no warning. And this can't be overflow since floats can take higher values. So I can't explain this result.
The issue is that we get no warning.
Floating-point is intended to approximate real-number arithmetic. So rounding during conversion is part of the design, meaning it is normal, so it does not get a warning. The closest value to 100008009 representable in float
is 100008008, so that is the result.