Think of a question:
1/3+1/3+1/3=1.0
0.3+0.3+0.3 =0.9
Think about what it means to be 1/3 in a decimal world! Its approach is to take a 1/3 very close to the decimal place, as in the example above the 0.3来 instead of 1/3, so the problem is to be stored in 3 1/3 out of only 0.9.
Maybe you feel like 1/3. This number is too special. It has no number, the approximate value is also no way to replace. But you know what? In the binary world 0.1 Such numbers are not exactly stored (float), and if you do not understand it, see the IEEE 754 standard. A 0.1 example is given below.
CREATE table t (x float); INSERT into t (x) values (0.1);
CREATE table t2 (x decimal); INSERT into T2 (0.1);
--------------------------------------------------------------------------------------------------------------- -------------------------------------------------------
Decimal is stored as a character, and its accuracy is not lost.
The difference between MySQL float and decimal.