Skip to content

Instantly share code, notes, and snippets.

@c0ldlimit
Created October 9, 2014 17:41
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 c0ldlimit/fd26843ad698957ae255 to your computer and use it in GitHub Desktop.
Save c0ldlimit/fd26843ad698957ae255 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(int argc, char * argv[]) {
float f = 19.86;
int x, k;
for (k=0; k < 32; ++k) {
x = *(int*)&f >> (k);
x = x & 1;
printf("%i is the bit\n", x);
}
/* 0 10000011 00111101110000101001000*/
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment