Skip to content

Instantly share code, notes, and snippets.

@njh
Created March 4, 2011 01:21
Show Gist options
  • Save njh/853980 to your computer and use it in GitHub Desktop.
Save njh/853980 to your computer and use it in GitHub Desktop.
// gcc -o float_test float_test.c && ./float_test
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
float f = 0.9;
int i = f * 10.0;
printf("f=%f\n", f);
printf("i=%d\n", i);
return 0;
}
// f=0.9
// i=8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment