Strange results with floating-point comparison

后端 未结 10 1749
余生分开走
余生分开走 2020-12-10 08:34

I have this simple test:

double h;
...
// code that assigns h its initial value, used below
...
if ((h>0) && (h<1)){
 //branch 1 -some computati         


        
10条回答
  •  青春惊慌失措
    2020-12-10 09:28

    You may be very interested in the Numerical Robustness for Geometric Calculations (aka "EPSILON is NOT 0.00001!") talk given at GDC 2005.

提交回复
热议问题