/* Boost math_constants.h header file (C) Copyright Paul A Bristow, hetp Chromatography, 2001 Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" with express or implied warranty, and with no claim as to its suitability for any purpose.*/ /* Written by J:\Cpp\WinNTL-5_0c\NTL5\defineConstants\defineConstants.cpp Thu Apr 19 23:16:40 2001 Using Victor Shoup's NTL version 5.0c (www.shoup.net/ntl) See MathConstants.html using an Internet Browser for documentation & sources. This file is a collection of the most basic mathematical constants that are like to be widely used - even by programs just computing areas of circles! The objective is to achieve the full accuracy possible with IEEE Floating point hardware and C and C++ languages. This has no extra cost to the user, but reduces irritating effects caused by the inevitable limitations of floating point calculations. At least these manifest as spurious least significant digits, at worst algorithms that err because comparisons fail. Aim for at least 36 decimal places to ensure no loss of accuracy even for long double. 36 decimal places: 0.123456789012345678901234567890123456L This .h file presents the constants as C/C++ preprocessor #define long double MACRO values. It can be used directly with the danger of name clashes, or with C++ wrapping as const long double values, (see math_constants.hpp) or template functions (see math_template_constants.hpp) that should allow programmers to avoid name clashes.*/ #ifndef BOOST_MATH_CONSTANTS_H #define BOOST_MATH_CONSTANTS_H /*Constants related to: Integers Unity and Two */ #define BOOST_ONE 1.L /* one */ #define BOOST_UNITY 1.L /* Unity */ #define BOOST_TWO 2.L /* Two */ #define BOOST_SQRTTWO 1.41421356237309504880168872420969808L /* sqrt(2) */ #define BOOST_ONEDIVSQRTTWO 0.707106781186547524400844362104849039L /* 1/sqrt(2) */ #define BOOST_HALFSQRTTWO 0.707106781186547524400844362104849039L /* sqrt(2)/2 */ #define BOOST_TWOPOWTHREEDIVTWO 2.82842712474619009760337744841939616L /* 2^(3/2) */ #define BOOST_TWOPOWMINUSTHREEDIVTWO 0.35355339059327376220042218105242452L /* 2^(-3/2) */ #define BOOST_CUBEROOTTWO 1.25992104989487316476721060727822835L /* 2^1/3 */ #define BOOST_FOURTHROOTTWO 1.18920711500272106671749997056047592L /* 2^1/4 */ #define BOOST_LOGTWO 0.693147180559945309417232121458176568L /* ln(2) */ #define BOOST_LNTWO 0.693147180559945309417232121458176568L /* Alias LOGTWO. */ #define BOOST_ONEDIVLNTWO 1.44269504088896340735992468100189214L /* 1/ln(2) */ #define BOOST_LOG10TWO 0.301029995663981195213738894724493027L /*log10(2) */ /* Three and up */ #define BOOST_THREE 3.L #define BOOST_ONETHIRD 0.333333333333333333333333333333333333L /* 1/3 */ #define BOOST_TWOTHIRDS 0.666666666666666666666666666666666667L /* 2/3 */ #define BOOST_SQRTTHREE 1.73205080756887729352744634150587237L /* 3^1/2 */ #define BOOST_CUBEROOTTHREE 1.44224957030740838232163831078010959L /* 3^1/2 */ #define BOOST_LOGTHREE 1.0986122886681096913952452369225257L /* ln(3) */ #define BOOST_SQRTFIVE 2.23606797749978969640917366873127624L /* sqrt(5) */ #define BOOST_SQRTTEN 3.16227766016837933199889354443271853L /* sqrt(10) */ #define BOOST_TEN 10.L #define BOOST_ONETENTH 0.1L /* 1/10 */ #define BOOST_LNTEN 2.30258509299404568401799145468436421L /* ln(10) */ #define BOOST_ONEDIVLNTEN 0.434294481903251827651128918916605082L /* 1/ln(10) */ /* exponential constant e */ #define BOOST_E 2.7182818284590452353602874713526625L /* E */ /* Archimedes constant pi */ #define BOOST_PI 3.14159265358979323846264338327950288L /* pi */ #define BOOST_QUARTERPI 0.785398163397448309615660845819875721L /* pi/4 */ #define BOOST_THIRDPI 1.04719755119659774615421446109316763L /* pi/3 */ #define BOOST_HALFPI 1.57079632679489661923132169163975144L /* pi/2 */ #define BOOST_ONEDIVPI 0.318309886183790671537767526745028724L /* 1/pi */ #define BOOST_TWODIVPI 0.636619772367581343075535053490057448L /* 2/pi */ #define BOOST_TWOPI 6.28318530717958647692528676655900577L /* 2 * pi */ #define BOOST_ONEDIVTWOPI 0.159154943091895335768883763372514362L /* 1/2*pi */ #define BOOST_THREEPI 9.42477796076937971538793014983850865L /* 3 * pi */ #define BOOST_SQRTPI 1.77245385090551602729816748334114518L /* sqrt(pi) */ #define BOOST_SQRTHALFPI 1.25331413731550025120788264240552263L /* sqrt(pi/2) */ #define BOOST_SQRTTWOPI 2.50662827463100050241576528481104525L /* sqrt(2*pi) */ #define BOOST_ONEDIVSQRTPI 0.564189583547756286948079451560772586L /* 1/sqrt(pi) */ #define BOOST_ONEDIVSQRTTWOPI 0.398942280401432677939946059934381868L /* 1/sqrt(2*pi) */ #define BOOST_PISQR 9.86960440108935861883449099987615114L /* pi^2 */ #define BOOST_PICUBED 31.0062766802998201754763150671013952L /* pi^3 */ #define BOOST_LNSQRTPI 0.572364942924700087071713675676529356L /* ln(sqrt(pi)) */ #define BOOST_LNSQRTTWOPI 0.91893853320467274178032973640561764L /* ln(sqrt(2*pi)) */ #define BOOST_LNSQRTHALFPI 0.225791352644727432363097614947441072L /* ln(sqrt(pi/2)) */ #define BOOST_LNPI 1.14472988584940017414342735135305871L /* ln(pi) */ #define BOOST_LNTWOPI 1.83787706640934548356065947281123528L /* ln(2*pi) */ #define BOOST_PIPOWPI 36.4621596072079117709908260226921237L /* pi^pi */ #define BOOST_PIPOWE 22.459157718361045473427152204543735L /* pi^e */ /* degree and radian. */ #define BOOST_DEGREE 0.0174532925199432957692369076848861271L /* radians = pi/180 */ #define BOOST_RADIAN 57.2957795130823208767981548141051703L /* degrees = 180/pi */ /* Trigonometric. */ #define BOOST_SINHONE 1.17520119364380145688238185059560082L /* sinh(1) */ #define BOOST_SINONE 0.841470984807896506652502321630299L/* sin(1) */ #define BOOST_COSONE 0.5403023058681397174009366074429766L /* cos(1) */ /* Euclid's "extreme and mean ratio" - D E Knuth, Vol 1 page 80 - 81. Greek artist Phidias is said to have used it in his sculpture. */ #define BOOST_PHI 1.61803398874989484820458683436563812L /*(1 + sqrt(5)) /2 */ #define BOOST_LNPHI 0.481211825059603447497758913424368423L /* ln(phi) */ #define BOOST_ONEDIVLNPHI 2.07808692123502753760132260611779577L /* 1/ln(phi) */ /* Exponential e */ #define BOOST_E 2.7182818284590452353602874713526625L /* exp(1) */ #define BOOST_ONEDIVE 0.367879441171442321595523770161460867L /* 1/e */ #define BOOST_EPOWE 15.1542622414792641897604302726299119L /* e^e */ #define BOOST_SQRTE 1.64872127070012814684865078781416357L /* sqrt(e) */ #define BOOST_ESQR 7.38905609893065022723042746057500781L /* e^2 */ #define BOOST_ECUBED 20.0855369231876677409285296545817179L /* e^3 */ #define BOOST_LOG10E 0.434294481903251827651128918916605082L /* log10(e) */ #define BOOST_ONEDIVLOG10 0.434294481903251827651128918916605082L /* 1/ln(10) */ #define BOOST_LOGTEN 2.30258509299404568401799145468436421L /* ln(10) */ #define BOOST_LNE 1.L /* log(e) == (real_type)unity. */ #define BOOST_EPOWPI 23.1406926327792690057290863679485474L /* e^pi */ #define BOOST_EPOWHALFPI 4.81047738096535165547303566670383313L /* e^(pi/2) */ #define BOOST_EPOWQUARTERPI 2.19328005073801545655976965927873822L /* e^(pi/4) */ #define BOOST_EPOWMINUSHALFPI 0.20787957635076190854695561983497877L /* e^(-pi/2) */ #define BOOST_EPOWMINUSQUARTERPI 0.455938127765996236765921294728029419L /* e^(-pi/4) */ #define BOOST_EPOWMINUSE 0.0659880358453125370767901875968464249L /* e^-e */ #define BOOST_EPOWEULER 1.78107241799019798523650410310717955L /* e^euler */ #define BOOST_EPOWMINUSEULER 0.561459483566885169824143214790880787L /* e^-euler */ /* gamma function or Euler constant. */ #define BOOST_EULER 0.577215664901532860606512090082402431L /* Euler alias gamma */ #define BOOST_GAMMA 0.577215664901532860606512090082402431L /* gamma */ #define BOOST_LNEULER -0.549539312981644822337661768802907788L /* ln(Euler) */ #define BOOST_GAMMAQUARTER 3.625609908221908311930685155867672L /* gamma(1/4) */ #define BOOST_GAMMATHIRD 2.67893853470774763365569294097467764L /* gamma(1/3) */ #define BOOST_GAMMAHALF 1.77245385090551602729816748334114518L /* gamma(1/2) */ #define BOOST_GAMMATWOTHIRDS 1.35411793942640041694528802815451379L /* gamma(2/3) */ #define BOOST_GAMMATHREEQUARTER 1.22541670246517764512909830336289053L /* gamma(3/4) */ #define BOOST_GAMMAFIVESIXTHS 1.12878702990812596126090109025884201L /* gamma(5/6) */ #define BOOST_GAMMASQR 0.333177923807718674318376136355244227L /* gamma^2 */ #define BOOST_GAMMACUBED 0.192315516821184589663192374419635907L /* gamma^3 */ #define BOOST_GAMMAMIN 1.46163214496836234126265954232572133L /* Minimum gamma */ /* Minimum gamma(1.46) has the minimum value of 0.88... */ #define BOOST_GAMMAMINVALUE 0.885603194410888700278815900582588733L #define BOOST_GAMMAZERO LDBL_MAX /* == infinity. */ #define BOOST_GAMMAONE 1.L /* by definition. */ #define BOOST_GAMMATWO 1.L /* by definition. */ #define BOOST_GAMMATHREE 2.L /* factorial(2) == 2! */ #define BOOST_GAMMAFOUR 6.L /* factorial(3) == 3! */ #define BOOST_GAMMAFIVE 24L. /* factorial(4) == 4! */ #define BOOST_GAMMASIX 120L. /* factorial(5) == 5! */ #define BOOST_LNGAMMAZERO LDBL_MAX /* == DBL_MAX or LDBL_MAX, or infinity? */ #define BOOST_LNGAMMA -0.549539312981644822337661768802907788L /* ln(gamma) */ #define BOOST_LNGAMMASIXTH 1.71673343507824046052784630958793076L /* ln(gamma(1/6)) */ #define BOOST_LNGAMMAQUARTER 1.2880225246980774573706104402197173L /* ln(gamma(1/4)) */ #define BOOST_LNGAMMATHIRD 0.985420646927767069187174036977961392L /* ln(gamma(1/3)) */ #define BOOST_LNGAMMAHALF 0.572364942924700087071713675676529356L /* ln(gamma(1/2)) */ #define BOOST_LNGAMMATWOTHIRDS 0.303150275147523568675862817372011036L /* ln(gamma(2/3)) */ #define BOOST_LNGAMMATHREEQUARTERS 0.2032809514312953714814329718624297L /* ln(gamma(3/4)) */ #define BOOST_LNGAMMAFIVESIXTHS 0.121143631331105023032813163223304522L /* ln(gamma(5/6)) */ #define BOOST_LNGAMMAONE 0.L/* ln(1) by definition. */ #define BOOST_LNGAMMAMIN 0.379553718839517997125063836438464837L /* ln(gamma(min)) */ #define BOOST_LNGAMMATWO 0.L /* ln(1) by definition. */ #define BOOST_LNGAMMATHREE 0.693147180559945309417232121458176L /* gamma(3) = ln(2!) */ #define BOOST_LNGAMMAFOUR 1.79175946922805500081247735838071L /* gamma(4) = ln(3!) */ #define BOOST_LNGAMMAFIVE 3.17805383034794561964694160129705L /* gamma(5) = ln(4!) */ #define BOOST_LNGAMMASIX 4.78749174278204599424770093452327L /* gamma(6) = ln(5!) */ #define BOOST_CF 1.03064083410071293588177609411693684L /* Continued fraction (base 10) */ #define BOOST_ZETATWO 1.64493406684822643647241516664602519L /* zeta(2) */ #define BOOST_ZETATHREE 1.20205690315959428539973816151144999L /* zeta(3) */ /* End of math_constants.h */ #endif // BOOST_MATH_CONSTANTS_H