价格是浮点数还是小数点?

哪种类型(浮点型或十进制)最适合在 mysql 数据库中存储价格?

Which type (Float or decimal) is best used to store prices in a mysql database?

推荐答案

浮点数不精确,会引入累积舍入误差.十进制是财务信息必须准确的最佳格式.

Floats are not exact and can introduce cumulative rounding errors. Decimal is the best format for financial information that must be exact.

相关文章