Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的数据库表中,我有一个字段浮动,如果我插入成本4559006保存为4.55901e+006并且当我对其执行数学运算时,它会产生错误,我会在其中存储项目成本。
我该如何解决?
浮点类型不适合精确计算
利用decimal(15,2)
decimal(15,2)
15 是有效位数,包括刻度 2。如果需要,您可以将其增加到 65。
http://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html