math: Add long double constant definitions
These constants are GNU libc extensions that are likely to be adopted by the next POSIX revision [1]. The definitions can be verified in a PARI-GP shell session: * M_El: exp (1) * M_LOG2El: log (exp (1)) / log (2) * M_LOG10El: log (exp (1)) / log (10) * M_LN2l: log (2) * M_LN10l: log (10) * M_PIl: Pi * M_PI_2l: Pi / 2 * M_PI_4l: Pi / 4 * M_1_PIl: 1 / Pi * M_2_PIl: 2 / Pi * M_2_SQRTPIl: 2 / sqrt (Pi) * M_SQRT2l: sqrt (2) * M_SQRT1_2l: 1 / sqrt (2) [1] https://austingroupbugs.net/view.php?id=828 Put these behind __BSD_VISIBLE || __XSI_VISIBLE >= 800 to future-proof these changes. They shouldn't be defined at lower levels of XSI, but don't have other XSI 800 stuff in place yet. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed by: imp, allanjude Pull Request: https://github.com/freebsd/freebsd-src/pull/1121
This commit is contained in:
@@ -142,6 +142,22 @@ typedef __float_t float_t;
|
||||
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
|
||||
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
|
||||
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE >= 800
|
||||
#define M_El 2.718281828459045235360287471352662498L /* e */
|
||||
#define M_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */
|
||||
#define M_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */
|
||||
#define M_LN2l 0.693147180559945309417232121458176568L /* log_e 2 */
|
||||
#define M_LN10l 2.302585092994045684017991454684364208L /* log_e 10 */
|
||||
#define M_PIl 3.141592653589793238462643383279502884L /* pi */
|
||||
#define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */
|
||||
#define M_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */
|
||||
#define M_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */
|
||||
#define M_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */
|
||||
#define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
|
||||
#define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */
|
||||
#define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
|
||||
#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 800 */
|
||||
|
||||
#define MAXFLOAT ((float)3.40282346638528860e+38)
|
||||
extern int signgam;
|
||||
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
|
||||
|
||||
Reference in New Issue
Block a user