fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5.  
  6. float f=0.0f;
  7. int i;
  8.  
  9. for(i=0;i<10;i++)
  10. {
  11. f = f + 0.1f;
  12. printf("%.32f\n",f);
  13.  
  14. }
  15.  
  16. if(f == 1.0f)
  17. printf("f is 1.0 \n");
  18. else
  19. printf("f %f is NOT 1.0\n",f);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
0.10000000149011611938476562500000
0.20000000298023223876953125000000
0.30000000447034835815429687500000
0.40000001341104507446289062500000
0.50000000745058059692382812500000
0.60000000149011611938476562500000
0.70000002533197402954101562500000
0.80000004917383193969726562500000
0.90000007301568984985351562500000
1.00000009685754776000976562500000
f 1.000000 is NOT 1.0