胡说叔叔
对于乘法,我们只需将每个参数中的小数位数加在一起(使用钢笔和纸张)来计算输出dec位置。但师只是把你的头分开了。我现在要躺下了。但在SQL术语中,它完全符合预期。--Precision = p1 - s1 + s2 + max(6, s1 + p2 + 1)--Scale = max(6, s1 + p2 + 1)--Scale = 15 + 38 + 1 = 54--Precision = 30 - 15 + 9 + 54 = 72--Max P = 38, P & S are linked, so (72,54) -> (38,20)--So, we have 38,20 output (but we don use 20 d.p. for this sum) = 11.74438969709659SELECT CONVERT(DECIMAL(30,15),146804871.212533)/CONVERT(DECIMAL (38,9),12499999.9999)--Scale = 15 + 38 + 1 = 54--Precision = 30 - 15 + 15 + 54 = 84--Max P = 38, P & S are linked, so (84,54) -> (38,8)--So, we have 38,8 output = 11.74438969SELECT CONVERT(DECIMAL(30,15),146804871.212533)/CONVERT(DECIMAL (38,15),12499999.9999)如果您将每个数字对视为,则如果遵循此规则,您也可以执行相同的数学运算146804871.212533000000000和12499999.999900000146804871.212533000000000和12499999.999900000000000