fork download
  1. #include <iostream>
  2.  
  3. inline float asfloatbits(int x){
  4. return *(float *) &x;
  5. }
  6.  
  7. inline float asfloatvalue(int x){
  8. return (float)x;
  9. }
  10.  
  11. int main()
  12. {
  13. int abc = 12341234;
  14. std::cout << asfloatbits(abc) << std::endl;
  15. std::cout << asfloatvalue(abc) << std::endl;
  16. }
  17.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
1.72938e-38
1.23412e+07