Hi everyone! I'm excited (and a bit nervous) to share UniversalConstants (v1.0.0) , my very first open-source C++ library.
Motivation
I got tired of repeatedly defining PI across different files or fighting dependency hell when switching between quick prototypes and high-precision scientific calculations. So I built a C++17 library with a unified "Parentheses Precision Syntax" NAME(digits) and Dual-Mode Support :
Lightweight Header-Only Mode (Zero Dependencies) : Just drop BasicConstants.h into your project for standard double -precision constants ( BasicConstants::PI , BasicConstants::C , etc.).
GMP Hardcore Mode (Arbitrary Precision) : Powered by GMP, you specify the exact decimal digits you need inside parentheses:
#include <iostream> #include "UniversalConstants.h"
using namespace UniversalConstants :: Math ; using namespace UniversalConstants :: Physics ;
int main ( ) { // Computes 3.6 million digits of Pi on the fly using Chudnovsky binary splitting mpf_class huge_pi = PI ( 3600000 ) ;
//…