Addition of Double values inconsistent

后端 未结 7 2054
渐次进展
渐次进展 2021-01-20 01:13

I came across following issue while developing some engineering rule value engine using eval(...) implementation.

    Dim first As Double = 1.1
    Dim secon         


        
7条回答
  •  难免孤独
    2021-01-20 01:19

    In C#, Java, Python, and many other languages, decimals/floats are not perfect. Because of the way they are represented (using multipliers and exponents), they often have inaccuracies. See http://www.yoda.arachsys.com/csharp/decimal.html for more info.

提交回复
热议问题