Skip to content

Instantly share code, notes, and snippets.

@tajo
Created October 16, 2013 13:20
Show Gist options
  • Save tajo/7007625 to your computer and use it in GitHub Desktop.
Save tajo/7007625 to your computer and use it in GitHub Desktop.
Double compare
#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