我想问一下如何查看读取的值是否接近常量中保存的值。是否有具体说明或有任何方法可以做到这一点 等待你的回复。
问候
Salik Sadruddin Merani
示例:
//Here is what I mean
if ( a is near to b){
then do this
}
答案 0 :(得分: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 )
{
}