fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. template <typename T>
  5. const auto PI = std::acos(static_cast<T>(-1));
  6.  
  7. template <typename T>
  8. const T PI2 = std::acos(static_cast<T>(-1));
  9.  
  10. template <typename T>
  11. const T DEG_TO_RAD = PI2<T> / 180;
  12.  
  13. int main()
  14. {
  15. // uncomment this to fix CASE 1 in VS2017
  16. // PI<float>;
  17.  
  18. // uncomment this to fix CASE 2 in VS2017
  19. // PI2<float>;
  20.  
  21. // CASE 1 - prints 0 should be 3.14159
  22. auto func = []() { std::cout << PI<float> << std::endl; };
  23. func();
  24.  
  25. // CASE 2 - prints 0 should be 0.0174533
  26. std::cout << DEG_TO_RAD<float> << std::endl;
  27. }
Success #stdin #stdout 0s 4272KB
stdin
Standard input is empty
stdout
3.14159
0.0174533