From f4072a50389474e476719090124e56abcbb396fd Mon Sep 17 00:00:00 2001 From: Hediadyoin1 Date: Fri, 7 May 2021 14:01:03 +0200 Subject: [PATCH] LibM: Add long double defines of Math Constants --- Userland/Libraries/LibM/math.cpp | 2 +- Userland/Libraries/LibM/math.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibM/math.cpp b/Userland/Libraries/LibM/math.cpp index 653adb61778..53a7d522c47 100644 --- a/Userland/Libraries/LibM/math.cpp +++ b/Userland/Libraries/LibM/math.cpp @@ -320,7 +320,7 @@ static FloatT internal_gamma(FloatT x) NOEXCEPT } // Stirling approximation - return sqrtl(2.0 * M_PI / static_cast(x)) * powl(static_cast(x) / M_E, static_cast(x)); + return sqrtl(2.0 * M_PIl / static_cast(x)) * powl(static_cast(x) / M_El, static_cast(x)); } extern "C" { diff --git a/Userland/Libraries/LibM/math.h b/Userland/Libraries/LibM/math.h index 8326d5af878..a54e81ac639 100644 --- a/Userland/Libraries/LibM/math.h +++ b/Userland/Libraries/LibM/math.h @@ -29,6 +29,20 @@ __BEGIN_DECLS #define NAN __builtin_nan("") #define MAXFLOAT FLT_MAX +#define M_El 2.718281828459045235360287471352662498L +#define M_LOG2El 1.442695040888963407359924681001892137L +#define M_LOG10El 0.434294481903251827651128918916605082L +#define M_LN2l 0.693147180559945309417232121458176568L +#define M_LN10l 2.302585092994045684017991454684364208L +#define M_PIl 3.141592653589793238462643383279502884L +#define M_PI_2l 1.570796326794896619231321691639751442L +#define M_PI_4l 0.785398163397448309615660845819875721L +#define M_1_PIl 0.318309886183790671537767526745028724L +#define M_2_PIl 0.636619772367581343075535053490057448L +#define M_2_SQRTPIl 1.128379167095512573896158903121545172L +#define M_SQRT2l 1.414213562373095048801688724209698079L +#define M_SQRT1_2l 0.707106781186547524400844362104849039L + #define M_E 2.7182818284590452354 #define M_LOG2E 1.4426950408889634074 #define M_LOG10E 0.43429448190325182765