| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

log2.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG2_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG2_HPP
3
4 #include <stan/math/prim/scal/fun/constants.hpp>
5 #include <boost/math/tools/promotion.hpp>
6 #include <math.h>
7 #include <stdexcept>
8
9 namespace stan {
10 namespace math {
11
23 template <typename T>
24 inline typename boost::math::tools::promote_args<T>::type
25 log2(const T& a) {
26 using std::log;
27 return log(a) / LOG_2;
28 }
29
38 inline double log2(int x) {
39 return log2(static_cast<double>(x));
40 }
41
47 inline double log2() {
48 return LOG_2;
49 }
50
51 }
52 }
53
54 #endif
stan::math::LOG_2
const double LOG_2
The natural logarithm of 2, .
Definition: constants.hpp:32
stan
Definition: log_sum_exp.hpp:8
stan::math::log
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:14
constants.hpp
stan::math::log2
fvar< T > log2(const fvar< T > &x)
Definition: log2.hpp:14

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