Write a statement which sees it a variable is near the value save in C [closed]
-
25-06-2021 - |
Pregunta
I want to ask that how can I see if a value read is near the value saved in a constant. Is there a specific statement for that or is there any way to do that.
Awaiting your Replies.
Regards
Salik Sadruddin Merani
example:
//Here is what I mean
if ( a is near to b){
then do this
}
Solución
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 )
{
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow