Skip to content

Instantly share code, notes, and snippets.

@Adobe-Android
Created November 20, 2020 05:58
Show Gist options
  • Save Adobe-Android/e7a27b48887fe00457d55d48536522c9 to your computer and use it in GitHub Desktop.
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
#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