Skip to content

Instantly share code, notes, and snippets.

@hacosta
Created September 10, 2013 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hacosta/6514959 to your computer and use it in GitHub Desktop.
Save hacosta/6514959 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
int main()
{
double x = 0.5;
printf("orig\tround\tfloor\tceil\n");
printf("%.2f\t%.2f\t%.2f\t%.2f\n", x, round(x), floor(x), ceil(x));
return 0;
}
@hacosta
Copy link
Author

hacosta commented Sep 10, 2013

orig round floor ceil
0.40 0.00 0.00 1.00
0.50 1.00 0.00 1.00
0.60 1.00 0.00 1.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment