Created
November 20, 2020 05:58
-
-
Save Adobe-Android/e7a27b48887fe00457d55d48536522c9 to your computer and use it in GitHub Desktop.
Takes advantage of the C++20 mathematical constants in the new <numbers> header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iomanip> | |
#include <iostream> | |
#include <numbers> | |
// Uses C++20 features. | |
void PrintPi() { | |
std::cout << std::setprecision(16) << std::numbers::pi_v<long double> << '\n'; | |
} | |
int main() { | |
PrintPi(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment