This question already has an answer here:
- Is floating point math broken? 18 answers
Output of the C code here is "outside if condition". As x is float it should enter the if condition isn't it?
#include <stdio.h>
main()
{
float x = 0.2;
if (x==0.2)
printf("x=0.2 \n");
else
printf("outside if condition");
}
Aucun commentaire:
Enregistrer un commentaire