fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5. int main(void) {
  6. double max1 = pow(2, 64) - 1;
  7. std::cout << "pow(2, 64) - 1 = " << std::fixed << max1 << '\n';
  8. std::cout << "Previous representable value: " << std::nextafter(max1, 0) << '\n';
  9. std::cout << (pow(2, 64) - 1 == pow(2, 64)) << '\n';
  10.  
  11. long double max2 = pow(2.0L, 64) - 1.0L;
  12. std::cout << std::fixed << max2 << '\n';
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
pow(2, 64) - 1 = 18446744073709551616.000000
Previous representable value: 18446744073709549568.000000
1
18446744073709551615.000000