Modulus warning

hi, modulus gives a warning

Newperiod = SecNumber % TimeFrame == 0;

it gives the 505 warning division by zero.

I can avoid it by using:

Newperiod = SecNumber % ( TimeFrame + 1e-9 ) == 0;

but I wonder if this warning should be in there. Thanks

If TimeFrame variable is zero then your modulus operator involves division by zero.

Modulus involves division.

You can check yourself:

if( TimeFrame == 0 ) Error("The TimeFrame variable is zero");
1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.