I ran into this issue wherein inserting a number like 1234567 to a float column leads to a rounded off value of 1234570.
I understand that this is due to float point precision but what confuses me is that if I do some calculation with the above float column, then it uses the actual value (1234567).
If I just use a Select statement on the column it gives out the rounded off value, but if I cast it to decimal or perform some calculations on it, it does so with the actual value.
So my question is what makes MySQL act like this?
EDIT:
For example:
select cast(1234567 as float), cast(1234567 as float) + 1
returns:
1234570 1234568
Here is a db<>fiddle.