fork download
  1. #include <cmath>
  2. #include <iostream>
  3. #include <limits>
  4.  
  5. int main()
  6. {
  7. std::cout.precision(std::numeric_limits<float>::digits10);
  8. double PIf = acos(-1.0F);
  9. std::cout << "PIf " << sizeof(float) << " : " << PIf << std::endl;
  10.  
  11. std::cout.precision(std::numeric_limits<double>::digits10);
  12. double PId = acos(-1.0);
  13. std::cout << "PId " << sizeof(double) << " : " << PId << std::endl;
  14.  
  15. std::cout.precision(std::numeric_limits<long double>::digits10);
  16. long double PIl = std::acos(-1.0L);
  17. std::cout << "PIl " << sizeof(long double) << " : " << PIl << std::endl;
  18. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
PIf 4 :  3.14159
PId 8 :  3.14159265358979
PIl 12 : 3.14159265358979324