Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Operator in C: not greater and equal to.

Tags:

c

operators

Just a fast question:

I'm trying to test if a variable is not greater than or equal to another variable.

I have it coded as such:

if (f!>=i){
print ("True");}

but my c compiler won't recognize it. I can't find it online, is it possible?

like image 232
Unknown Avatar asked Dec 07 '22 11:12

Unknown


1 Answers

Just change it to (f < i) which is !(f >= i).

Note: this is not the case if either f or i is NaN. This is because f >= i will evaluate to false if either is NaN leading to !(f >= i) evaluating to true where f < i evaluates to false.

like image 112
Fantastic Mr Fox Avatar answered Dec 09 '22 01:12

Fantastic Mr Fox