Advertisement
Guest User

Untitled

a guest
Aug 10th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. unsigned int z;
  5. int expo = 0;
  6. scanf("%u", &z);
  7. float unsignedToFloat(unsigned int x) {
  8. }
  9. /*float unsignedToFloat(unsigned int x) {
  10. float result;
  11. result = (float)x;
  12. return result;
  13. }*/
  14. void exponent(unsigned int x) {
  15. x = x / 2;
  16. if (x > 1) {
  17. expo = expo + 1;
  18. exponent(x);
  19. }
  20. if(x == 1) {
  21. expo = expo + 1;
  22. }
  23. }
  24. exponent(z);
  25. printf("%i\n",expo);
  26. unsigned int flo = expo + 127;
  27. printf("%i\n", flo);
  28. unsigned int big = 2 << expo;
  29. printf("%i\n", big);
  30. unsigned int left = z - big;
  31. printf("%i\n", left);
  32. unsigned int done = ((flo << 23) + left);
  33. printf("%i\n",done);
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement