Created
August 17, 2017 02:48
-
-
Save pandax381/2bce5b76e44a6221a076c123d6115c53 to your computer and use it in GitHub Desktop.
simple float test
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> | |
#include <stdint.h> | |
int | |
main (void) { | |
float a = 1.0; | |
float b = 2.0; | |
float c = a + b; | |
fprintf(stderr, "sizeof(float): %d\n", sizeof(float)); | |
fprintf(stderr, "0x%x (%f) + 0x%x (%f) = 0x%x (%f)\n", | |
*(uint32_t *)&a, a, | |
*(uint32_t *)&b, b, | |
*(uint32_t *)&c, c | |
); | |
return 0; | |
} |
Author
pandax381
commented
Aug 17, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment