Home  >  Article  >  Database  >  mysql advanced (10) unreliable FLOAT data type

mysql advanced (10) unreliable FLOAT data type

黄舟
黄舟Original
2017-02-09 15:34:231126browse

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)!


Statement:
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