Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 计算结果因十进制或双精度而异_.net_Vb.net_Math_Double_Decimal - Fatal编程技术网

.net 计算结果因十进制或双精度而异

.net 计算结果因十进制或双精度而异,.net,vb.net,math,double,decimal,.net,Vb.net,Math,Double,Decimal,有人能解释一下为什么计算值180*2.2在十进制和双精度存储时会不同;也许还可以解释为什么.NET在计算180*2.2时会在第一位加一个小数点 标准计算器:396 表达式(双精度):396.00000000000006 转换为十进制的表达式:396 双精度并不是一个精确的表示法:有很多舍入和截断(但你得到的范围要大得多) 阅读:

有人能解释一下为什么计算值180*2.2在十进制和双精度存储时会不同;也许还可以解释为什么.NET在计算180*2.2时会在第一位加一个小数点

  • 标准计算器:396
  • 表达式(双精度):396.00000000000006
  • 转换为十进制的表达式:396

双精度并不是一个精确的表示法:有很多舍入和截断(但你得到的范围要大得多)

阅读: