Created
May 15, 2014 18:09
-
-
Save stoffie/993bb734747bf85521b0 to your computer and use it in GitHub Desktop.
dump_float.c
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 <stdlib.h> | |
#include <string.h> | |
int main (int argc, char ** argv) | |
{ | |
float f; | |
int i; | |
unsigned int f_dump; | |
unsigned int mask = 1 << 32 - 1; | |
f = atof(argv[1]); | |
memcpy(&f_dump, &f, sizeof(float)); | |
printf("seeeeeeeemmmmmmmmmmmmmmmmmmmmmmm\n"); | |
for (i = 0; i < 32; i++) { | |
printf(f_dump & mask ? "1" : "0"); | |
mask >>= 1; | |
} | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment