感觉这个不应该放在数据库层面实现。
https://dev.mysql.com/doc/refman/8.0/en/precision-math-rounding.html
即便是mysql,都有这么一句提示.
* For approximate-value numbers, the result depends on the C library. On many systems, this means that [
ROUND()](https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_round) uses the “round to nearest even” rule: A value with a fractional part exactly half way between two integers is rounded to the nearest even integer.
round的类型根据计算,有一部分是依赖c 库实现的。这可能会在不同平台上造成不同的表现。文档链接里面有例子。
如果数据类型,c库,这些乱七八糟的问题都会导致结果不稳定,怎么看都是应用层来实现会比较好。