fork(5) download
  1. #include <iostream>
  2. #include <limits>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. uint32_t r1 = numeric_limits<uint32_t>::max();
  9. float r2 = static_cast<float>(numeric_limits<uint32_t>::max());
  10. uint32_t r3 = static_cast<uint32_t>(r2); // static_cast<uint32_t>(static_cast<double>(numeric_limits<uint32_t>::max()));
  11.  
  12.  
  13. cout << "r1 = " << r1 << endl
  14. << "r2 = " << r2 << endl
  15. << "r3 = " << r3 << endl
  16. << "sizeof(float) = " << sizeof(float) << endl;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
r1 = 4294967295
r2 = 4.29497e+09
r3 = 4294967295
sizeof(float) = 4