-2

我想问我如何查看读取的值是否接近保存在常量中的值。是否有特定的声明或有什么方法可以做到这一点。
等待您的回复。

问候
萨利克·萨德鲁丁·梅拉尼

例子:

//Here is what I mean
if ( a is near to b){
then do this
}
4

1 回答 1

4
if( ( a>(b*0.98) ) && ( a<(b*1.02) ) )
{
    //we have %2 error tolerance here. Bee careful! Dont pass the tol. level.
    //do your work yourself, if you cant find, then ask us. Dont forget
    //to google
 }


if( abs(a-b)<(b*0.02) )
 {

  }

if ( abs((a-b)(a+b))<0.07 )
  {


   }


if(check(a,b))
{

}


if( pre_calculated )
{

 }
于 2012-08-13T10:47:51.933 回答