Stan Math Library  2.20.0
reverse mode automatic differentiation
log1p.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_LOG1P_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_LOG1P_HPP
3 
7 #include <cmath>
8 
9 namespace stan {
10 namespace math {
11 
27 inline double log1p(double x) {
28  if (is_nan(x)) {
29  return x;
30  } else {
31  check_greater_or_equal("log1p", "x", x, -1.0);
32  return std::log1p(x);
33  }
34 }
35 
45 inline double log1p(int x) {
46  if (is_nan(x)) {
47  return x;
48  } else {
49  check_greater_or_equal("log1p", "x", x, -1);
50  return std::log1p(x);
51  }
52 }
53 
54 } // namespace math
55 } // namespace stan
56 #endif
void check_greater_or_equal(const char *function, const char *name, const T_y &y, const T_low &low)
Check if y is greater or equal than low.
var log1p(const var &a)
The log (1 + x) function for variables (C99).
Definition: log1p.hpp:29
fvar< T > log1p(const fvar< T > &x)
Definition: log1p.hpp:12
int is_nan(const fvar< T > &x)
Returns 1 if the input&#39;s value is NaN and 0 otherwise.
Definition: is_nan.hpp:20

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