[CI SKIP] Local constants for diagnostic purposes

This commit is contained in:
Christopher Kormanyos
2021-01-30 13:42:02 +01:00
parent 38b4909972
commit 623a7da431
+38 -3
View File
@@ -51,7 +51,6 @@
#include <thread>
#include <vector>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/prime.hpp>
#define BOOST_MULTIPRECISION_EXERCISE_THREADING_BACKEND_CPP_DEC_FLOAT 101
@@ -220,6 +219,42 @@ const std::vector<std::uint32_t>& primes()
return my_primes;
}
template<typename StringConstructableFloatType>
const StringConstructableFloatType& pi()
{
static const StringConstructableFloatType my_pi
(
"3."
"1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
"8214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196"
"4428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273"
"7245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094"
"3305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912"
"9833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132"
"0006"
);
return my_pi;
}
template<typename StringConstructableFloatType>
const StringConstructableFloatType& ln_two()
{
static const StringConstructableFloatType my_ln_two
(
"0."
"6931471805599453094172321214581765680755001343602552541206800094933936219696947156058633269964186875"
"4200148102057068573368552023575813055703267075163507596193072757082837143519030703862389167347112335"
"0115364497955239120475172681574932065155524734139525882950453007095326366642654104239157814952043740"
"4303855008019441706416715186447128399681717845469570262716310645461502572074024816377733896385506952"
"6066834113727387372292895649354702576265209885969320196505855476470330679365443254763274495125040606"
"9438147104689946506220167720424524529612687946546193165174681392672504103802546259656869144192871608"
"2938"
);
return my_ln_two;
}
} // namespace detail
template<typename FloatingPointType>
@@ -290,8 +325,8 @@ FloatingPointType log(const FloatingPointType& x)
// Retrieve the value of pi, divide by (2 * a) and subtract (m * ln2).
const FloatingPointType result =
boost::math::constants::pi<FloatingPointType>() / (ak * 2)
- (boost::math::constants::ln_two<FloatingPointType>() * m);
detail::pi<FloatingPointType>() / (ak * 2)
- (detail::ln_two<FloatingPointType>() * m);
return ((b_negate == true) ? -result : result);
}