powershell 小数计算
js的小数加减乘除的结果
console.log(1.0 - 0.9);
// 0.09999999999999998
console.log(0.3 / 0.1);
// 2.9999999999999996
console.log(9.7 * 100);
// 969.9999999999999
console.log(2.22 + 0.1);
// 2.3200000000000003
python小数计算 结果
0.1 + 0.2
# 0.30000000000000004
powershell小数计算
1.0-0.9
# 0.1
0.3/0.1
# 3
9.7 * 100
# 970
2.22 + 0.1
# 2.32
40-39.2
# 0.799999999999997
# 差点就被骗了...
40 - 39.2d
# 0.8
40d - 39.2
# 0.8
# 添加类型作个弊,相当于
40 - [decimal]39.2
# 0.8
39.2d.getType().name
# Decimal
$a=40; $b=39.2; [decimal]$a - [decimal]$b
# 0.8