Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
constants.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__CONSTANTS_HPP
2 #define STAN__MATH__CONSTANTS_HPP
3 
4 #include <boost/math/constants/constants.hpp>
5 
6 namespace stan {
7 
8  namespace math {
9 
14  const double E = boost::math::constants::e<double>();
15 
20  const double SQRT_2 = std::sqrt(2.0);
21 
26  const double INV_SQRT_2 = 1.0 / SQRT_2;
27 
32  const double LOG_2 = std::log(2.0);
33 
38  const double LOG_10 = std::log(10.0);
39 
43  const double INFTY = std::numeric_limits<double>::infinity();
44 
48  const double NEGATIVE_INFTY = - std::numeric_limits<double>::infinity();
49 
53  const double NOT_A_NUMBER = std::numeric_limits<double>::quiet_NaN();
54 
58  const double EPSILON = std::numeric_limits<double>::epsilon();
59 
63  const double NEGATIVE_EPSILON = - std::numeric_limits<double>::epsilon();
64 
65 
66  /*
67  * Log pi divided by 4
68  * \f$ \log \pi / 4 \f$
69  */
70  const double LOG_PI_OVER_FOUR = std::log(boost::math::constants::pi<double>()) / 4.0;
71 
77  inline double pi() {
78  return boost::math::constants::pi<double>();
79  }
80 
86  inline double e() {
87  return E;
88  }
89 
95  inline double sqrt2() {
96  return SQRT_2;
97  }
98 
99 
105  inline double log10() {
106  return LOG_10;
107  }
108 
114  inline double positive_infinity() {
115  return INFTY;
116  }
117 
123  inline double negative_infinity() {
124  return NEGATIVE_INFTY;
125  }
126 
132  inline double not_a_number() {
133  return NOT_A_NUMBER;
134  }
135 
142  inline double machine_precision() {
143  return EPSILON;
144  }
145 
146  const double TWO_OVER_SQRT_PI = 2.0 / std::sqrt(boost::math::constants::pi<double>());
147 
149 
150  const double INV_SQRT_TWO_PI = 1.0 / std::sqrt(2.0 * boost::math::constants::pi<double>());
151 
152  }
153 }
154 
155 #endif
const double LOG_2
The natural logarithm of 2, .
Definition: constants.hpp:32
const double INV_SQRT_TWO_PI
Definition: constants.hpp:150
const double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition: constants.hpp:53
const double LOG_10
The natural logarithm of 10, .
Definition: constants.hpp:38
double sqrt2()
Return the square root of two.
Definition: constants.hpp:95
const double TWO_OVER_SQRT_PI
Definition: constants.hpp:146
const double SQRT_2
The value of the square root of 2, .
Definition: constants.hpp:20
const double INV_SQRT_2
The value of 1 over the square root of 2, .
Definition: constants.hpp:26
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:15
const double EPSILON
Smallest positive value.
Definition: constants.hpp:58
const double LOG_PI_OVER_FOUR
Definition: constants.hpp:70
double machine_precision()
Returns the difference between 1.0 and the next value representable.
Definition: constants.hpp:142
const double NEG_TWO_OVER_SQRT_PI
Definition: constants.hpp:148
double positive_infinity()
Return positive infinity.
Definition: constants.hpp:114
double e()
Return the base of the natural logarithm.
Definition: constants.hpp:86
const double E
The base of the natural logarithm, .
Definition: constants.hpp:14
double log10()
Return natural logarithm of ten.
Definition: constants.hpp:105
const double INFTY
Positive infinity.
Definition: constants.hpp:43
double pi()
Return the value of pi.
Definition: constants.hpp:77
double not_a_number()
Return (quiet) not-a-number.
Definition: constants.hpp:132
const double NEGATIVE_INFTY
Negative infinity.
Definition: constants.hpp:48
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:15
const double NEGATIVE_EPSILON
Largest negative value (i.e., smallest absolute value).
Definition: constants.hpp:63
double negative_infinity()
Return negative infinity.
Definition: constants.hpp:123

     [ Stan Home Page ] © 2011–2014, Stan Development Team.