价格是浮点数还是小数点? [英] Float or decimal for prices?

查看:46
本文介绍了价格是浮点数还是小数点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种类型(浮点型或十进制)最适合在 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.

这篇关于价格是浮点数还是小数点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆