main.cpp 406 B

12345678910111213141516171819202122232425
  1. #include <iostream>
  2. #include <bitset>
  3. using namespace std;
  4. int main()
  5. {
  6. float a = -0.33333333333; // 1 / 4
  7. int b = 1092830;
  8. cout << a << endl;
  9. float *addr = &a;
  10. int *int_addr = (int *)addr;
  11. int a_as_int = *int_addr;
  12. cout << bitset<32>(a_as_int) << endl;
  13. cout << 0b01111101 - 127 << endl;
  14. // cout << bitset<32>(a) << endl;
  15. // cout << bitset<32>(b) << endl;
  16. }