Ruby BigDecimal乘法

Ruby BigDecimal multiplication

我在 Bigdecimal 乘法方面遇到了麻烦。我有一个专栏:

t.decimal "average_price", precision: 8, scale: 2

我的样本 average_price 看起来像 "3.59280368"。当我尝试使用此值进行一些计算时,我得到:

@itam.average_price * 1000000 = 3590000

为什么不3592803

根据 rails api documentation:

The precision is the total number of significant digits and the scale is the number of digits that can be stored following the decimal point.

因此,在数据库中:3.59280368 将存储为 3.59