We are about to switch to a new forum software. Until then we have removed the registration on this forum.
if ( (-0.125) <= (angle) <= (0.125) ||
(0.375) <= (angle) <= (0.625) ||
(0.875) <= (angle) <= (1.125) ||
(1.375) <= (angle) <= (1.625)) {
minDist = 40*windows[i].q + 40*q;
}
else {
minDist = 40*windows[i].q*sqrt(2) + 40*q*sqrt(2);
}
After compiling program gives me an error: "The operator <= is undefined for the argument type(s) boolean, float" Same if I change <= to <. I also tried to replace numbers with variables, nothing helps.
What am I doing wrong?
Answers
you can't say (-0.125) <= (angle) <= (0.125)
you need
(-0.125) <= (angle) &&
(angle) <= (0.125)
Thank you, got if a sec before your answer. I'm such a moron :D
so you have to do it all step by step.
you could write a function
isValueInBetween (angle, -0.125, -0.125);
to make the code shorter
the function could look like