Skip to content

Commit

Permalink
LibM: Add long double defines of Math Constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendiadyoin1 authored and awesomekling committed Jul 2, 2021
1 parent c74d7ad commit f4072a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Userland/Libraries/LibM/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static FloatT internal_gamma(FloatT x) NOEXCEPT
}

// Stirling approximation
return sqrtl(2.0 * M_PI / static_cast<long double>(x)) * powl(static_cast<long double>(x) / M_E, static_cast<long double>(x));
return sqrtl(2.0 * M_PIl / static_cast<long double>(x)) * powl(static_cast<long double>(x) / M_El, static_cast<long double>(x));
}

extern "C" {
Expand Down
14 changes: 14 additions & 0 deletions Userland/Libraries/LibM/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f4072a5

Please sign in to comment.