#include <cassert> #include <iomanip> #include <iostream> #include <ostream> using namespace std; int main() { float pi = 1.1; int ipi; cout << setfill('0') << showbase << hex << internal; assert(sizeof(int) == sizeof(float)); ipi = reinterpret_cast<int&>(pi); cout << "pi bits=" << setw(10) << ipi << '\n'; }
pi bits=0x3f8ccccd