Home > Database > Mysql Tutorial > body text

mysql advanced (10) unreliable FLOAT data type

黄舟
Release: 2017-02-09 15:34:23
Original
1132 people have browsed it

Today when I was designing the data table, I suddenly discovered that FLOAT turned out to be very unreliable, so I suggest you change it to the DOUBLE type.

The reason is:

In the MySQL manual As mentioned in the article, all calculations in MySQL are completed using double precision. Using float (single precision) will cause errors and unexpected results.

When we query data, MySQL uses the precision of 64-bit decimal values ​​to perform the DECIMAL operation. float(5.54) = 5.54 If there is a loss of precision, this is not equal. In this way, the data that we should be able to find will disappear inexplicably.

The above is the content of mysql advanced (10) unreliable FLOAT data type. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template