C# float bug? 0.1 - 0.1 = 1.490116E-08

后端 未结 5 575
自闭症患者
自闭症患者 2020-12-03 16:23

What\'s going on?! Subtraction works fine until I get to 0.1 - 0.1. I\'m in visual c# 2008 using the nonoba.com API.

Console.WriteLine(\"hit! \" + Users[targ         


        
5条回答
  •  再見小時候
    2020-12-03 17:02

    Slighly offtopic, but here's an interesting read that describes why cos(x) != cos(y) can be true even if x == y:

    http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.18

提交回复
热议问题