浮点数的比较

xiaoxiao2021-02-28  91

a>b   if( (a-b) > EPSINON)a<b   if( (a-b) <-EPSINON)a>=b if( (a-b) >= -EPSINON)a<=b if( (a-b) <=  EPSINON)a==b if ((a-b>=-EPSINON) && (a-b<=EPSINON))

 

 

#include // Define your own tolerance

const double EPSILON = 1.00e-07; const float   FLT_EPSILON  = 1.192092896e-07F;

const double  DBL_EPSILON = 2.2204460492503131e-016;

转载请注明原文地址: https://www.6miu.com/read-75740.html

最新回复(0)