浮动或十进制的价格? [英] Float or decimal for prices?

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

问题描述

哪种类型(浮点数或十进制)最适合用于在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天全站免登陆