sql小数相乘出现零值问题
1.select cast( 0.0050000000 as decimal(38,23)) * cast(0.0000010000 as decimal(38,23)),此sql结果为何为0
select cast( 0.0050000000 as decimal(28,23)) * cast(0.0000010000 as decimal(28,23)) ,此sql值又不为零
2.
select cast( 0.01 as decimal(28,15)) * cast(0.0000000001 as decimal(28,15)) 结果为零
select cast( 0.01 as decimal(28,16)) * cast(0.0000000001 as decimal(28,16)) 结果不为零
我理解的sql小数相乘是这样的:
1.不同精度小数相乘,得出的结果小数精度会跟最大精度小数一致
2.当结果超出最大精度时,会按最大精度做四舍五入
现在看到的情况完全不明白发生了什么!