Automatic Differentiation
 
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_CONSTANTS_HPP
2#define STAN_MATH_PRIM_FUN_CONSTANTS_HPP
3
6#include <boost/math/constants/constants.hpp>
7#include <cmath>
8#include <limits>
9
10namespace stan {
11namespace math {
12
18static constexpr double e() { return boost::math::constants::e<double>(); }
19
25static constexpr double egamma() {
26 return boost::math::constants::euler<double>();
27}
28
34static constexpr double pi() { return boost::math::constants::pi<double>(); }
35
39static constexpr double EPSILON = std::numeric_limits<double>::epsilon();
40
44static constexpr double INFTY = std::numeric_limits<double>::infinity();
45
49static constexpr double NEGATIVE_INFTY = -INFTY;
50
54static constexpr double NOT_A_NUMBER = std::numeric_limits<double>::quiet_NaN();
55
60static constexpr double TWO_PI = boost::math::constants::two_pi<double>();
61
66static constexpr double LOG_ZERO = -INFTY;
67
72const double LOG_EPSILON = std::log(EPSILON);
73
78static constexpr double LOG_TWO = boost::math::constants::ln_two<double>();
79
84static constexpr double LOG_PI = 1.14472988584940017414342735135;
85
90static constexpr double LOG_HALF = -LOG_TWO;
91
96static constexpr double HALF_LOG_TWO_PI
97 = boost::math::constants::log_root_two_pi<double>();
98
104static constexpr double LOG_TWO_PI = 2 * HALF_LOG_TWO_PI;
105
110static constexpr double LOG_PI_OVER_FOUR = 0.25 * LOG_PI;
111
116static constexpr double LOG_SQRT_PI = LOG_PI / 2;
117
122static constexpr double LOG_TEN = boost::math::constants::ln_ten<double>();
123
128static constexpr double SQRT_TWO = boost::math::constants::root_two<double>();
129
134static constexpr double SQRT_PI = boost::math::constants::root_pi<double>();
135
140static constexpr double SQRT_TWO_PI
141 = boost::math::constants::root_two_pi<double>();
142
147static constexpr double SQRT_TWO_OVER_SQRT_PI
148 = boost::math::constants::root_two_div_pi<double>();
149
154static constexpr double INV_SQRT_TWO
155 = boost::math::constants::one_div_root_two<double>();
156
161static constexpr double INV_SQRT_PI
162 = boost::math::constants::one_div_root_pi<double>();
163
168static constexpr double INV_SQRT_TWO_PI
169 = boost::math::constants::one_div_root_two_pi<double>();
170
175static constexpr double TWO_OVER_SQRT_PI
176 = boost::math::constants::two_div_root_pi<double>();
177
182static constexpr double HALF_LOG_TWO = 0.5 * LOG_TWO;
183
188static constexpr double NEG_LOG_SQRT_TWO_PI = -HALF_LOG_TWO_PI;
189
193const double POISSON_MAX_RATE = std::pow(2.0, 30);
194
200static constexpr inline double positive_infinity() { return INFTY; }
201
207static constexpr inline double negative_infinity() { return NEGATIVE_INFTY; }
208
214static constexpr inline double not_a_number() { return NOT_A_NUMBER; }
215
222static constexpr inline double machine_precision() { return EPSILON; }
223
229static constexpr inline double log10() { return LOG_TEN; }
230
236static constexpr inline double sqrt2() { return SQRT_TWO; }
237
238} // namespace math
239} // namespace stan
240
241#endif
static constexpr double LOG_ZERO
The natural logarithm of 0, .
Definition constants.hpp:66
static constexpr double HALF_LOG_TWO
The value of half the natural logarithm 2, .
static constexpr double negative_infinity()
Return negative infinity.
static constexpr double LOG_HALF
The natural logarithm of 0.5, .
Definition constants.hpp:90
static constexpr double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition constants.hpp:54
static constexpr double positive_infinity()
Return positive infinity.
static constexpr double SQRT_TWO_OVER_SQRT_PI
The square root of 2 divided by the square root of , .
static constexpr double EPSILON
Smallest positive value.
Definition constants.hpp:39
static constexpr double e()
Return the base of the natural logarithm.
Definition constants.hpp:18
static constexpr double LOG_TWO_PI
The natural logarithm of , .
static constexpr double LOG_PI_OVER_FOUR
The value of one quarter the natural logarithm of , .
static constexpr double not_a_number()
Return (quiet) not-a-number.
const double POISSON_MAX_RATE
Largest rate parameter allowed in Poisson RNG.
static constexpr double LOG_TEN
The natural logarithm of 10, .
static constexpr double INV_SQRT_TWO
The value of 1 over the square root of 2, .
static constexpr double sqrt2()
Returns the square root of two.
static constexpr double INV_SQRT_TWO_PI
The value of 1 over the square root of , .
static constexpr double machine_precision()
Returns the difference between 1.0 and the next value representable.
static constexpr double NEGATIVE_INFTY
Negative infinity.
Definition constants.hpp:49
static constexpr double SQRT_TWO
The value of the square root of 2, .
static constexpr double SQRT_PI
The value of the square root of , .
static constexpr double LOG_TWO
The natural logarithm of 2, .
Definition constants.hpp:78
static constexpr double LOG_SQRT_PI
The natural logarithm of the square root of , .
static constexpr double LOG_PI
The natural logarithm of , .
Definition constants.hpp:84
static constexpr double SQRT_TWO_PI
The value of the square root of , .
static constexpr double log10()
Returns the natural logarithm of ten.
static constexpr double INV_SQRT_PI
The value of 1 over the square root of , .
static constexpr double TWO_PI
Twice the value of , .
Definition constants.hpp:60
static constexpr double TWO_OVER_SQRT_PI
The value of 2 over the square root of , .
static constexpr double NEG_LOG_SQRT_TWO_PI
The value of minus the natural logarithm of the square root of , .
static constexpr double pi()
Return the value of pi.
Definition constants.hpp:34
static constexpr double egamma()
Return the Euler's gamma constant.
Definition constants.hpp:25
static constexpr double HALF_LOG_TWO_PI
The value of half the natural logarithm , .
Definition constants.hpp:97
const double LOG_EPSILON
The natural logarithm of machine precision , .
Definition constants.hpp:72
static constexpr double INFTY
Positive infinity.
Definition constants.hpp:44
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...