Created
October 16, 2013 13:20
-
-
Save tajo/7007625 to your computer and use it in GitHub Desktop.
Double compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
int main(void) | |
{ | |
double a = 1.0 / 10.0; | |
double b = a * 10 - 1; | |
if (b == 0.0) | |
{ | |
printf("b == 0.0\n"); | |
return 0; | |
} | |
printf("b != 0.0\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment