Stan Math Library  2.14.0
reverse mode automatic differentiation
fmin.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_FMIN_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_FMIN_HPP
3 
5 #include <boost/math/tools/promotion.hpp>
6 
7 namespace stan {
8  namespace math {
9 
18  template <typename T1, typename T2>
19  inline typename boost::math::tools::promote_args<T1, T2>::type
20  fmin(const T1& x, const T2& y) {
21  if (is_nan(x)) return y;
22  if (is_nan(y)) return x;
23  return y > x ? x : y;
24  }
25 
26  }
27 }
28 #endif
fvar< T > fmin(const fvar< T > &x1, const fvar< T > &x2)
Definition: fmin.hpp:14
int is_nan(const fvar< T > &x)
Returns 1 if the input&#39;s value is NaN and 0 otherwise.
Definition: is_nan.hpp:21

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