| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

fdim.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_FDIM_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_FDIM_HPP
3
4 #include <math.h>
5 #include <boost/math/special_functions/fpclassify.hpp>
6 #include <boost/math/tools/promotion.hpp>
7 #include <cmath>
8 #include <limits>
9
10 namespace stan {
11 namespace math {
12
24 template <typename T1, typename T2>
25 inline typename boost::math::tools::promote_args<T1, T2>::type
26 fdim(T1 a, T2 b) {
27 using ::fdim;
28 using std::numeric_limits;
29 using boost::math::tools::promote_args;
30 if (boost::math::isnan(a) || boost::math::isnan(b))
31 return numeric_limits<typename promote_args<T1, T2>::type>::quiet_NaN();
32 return fdim(a, b);
33 }
34 }
35 }
36
37 #endif
stan
Definition: log_sum_exp.hpp:8
boost::math::isnan
bool isnan(const stan::math::var &v)
Checks if the given number is NaN.
Definition: boost_isnan.hpp:22
stan::math::fdim
fvar< T > fdim(const fvar< T > &x1, const fvar< T > &x2)
Definition: fdim.hpp:11
stan::math::fdim
var fdim(const stan::math::var &a, const double &b)
Return the positive difference between the first variable's value and the second value (C99)...
Definition: fdim.hpp:158

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