Testing for interval in days

Found problem after some debugging.

Hi,

Help needed please.

res stays zero and does not convert to a float to do the test ??

int dayson;
int days;
float res;
res = days/dayson;
if (round(days/dayson) == (days/dayson))
{
MET = 3;
}

res = days/dayson;

because both days and dayson are ints the rvalue is calculated using integer math,

try casting either or both to a float…

res = float(days)/dayson;
1 Like

Thanks.

Problem solved.

I must really ask the forum quicker for answers. Battled for a day !!!

1 Like