I wrote a simple function and would like to get know the assert macro in use. When I test the function (moving_hysteresis) after the sixth assert function I get an abort and I could not find out why. The moving_hysteresis() function follows:
float moving_hysteresis(float Delta,float temp)
{
float delta=Delta;
float temp_min=ZERO;
float temp_max=delta;
float result;
if(temp<=temp_max)
{
if(temp>=temp_min)
{
result=temp;
return result;
}
else
{
result=temp+delta;
return result;
}
}
else
{
result=temp-delta;
return result;
}
}
If I try to test this with
assert(moving_hsysteresis(5.00,-5.01)==(float)-0.01);
I get an assertion and I could not find out why... For example, if I try to test this with
assert(moving_hsysteresis(5.00,-2.36)==(float)2.64);
it works correctly. Somebody have any idea?