Created
October 18, 2011 17:20
-
-
Save Keruspe/1296023 to your computer and use it in GitHub Desktop.
Would this be a bug in the glibc ?
This file contains 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 <stdio.h> | |
int | |
main() | |
{ | |
float f = 3.5; | |
int i = 8; | |
const char *format_previous = "%f"; | |
printf ("This will output the previous float, expecting the good one\n"); | |
printf (format_previous, f); | |
printf (" (expected %f)\n", f); | |
printf (format_previous, i); | |
printf (" (expected %f)\n", (float) i); | |
printf ("This will output the good float, expecting 0\n"); | |
const char *format_0 = "%f (expected %f)\n"; | |
printf (format_0, f, f); | |
printf (format_0, i, (float) i); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment