+ 2
What is going on ?
float f1= 0.1; if(f1==0.1) printf("Equal\n"); else printf("Not equal\n");
1 Réponse
+ 5
If you mean it's not printing "Equal" it's because float type isn't that precise like double. You can find more info here: https://www.geeksforgeeks.org/difference-float-double-c-cpp/
You can see my example with double type and the expected output.
https://code.sololearn.com/c6p9wO042Zq9/?ref=app