Stan Math Library  2.14.0
reverse mode automatic differentiation
trunc.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_TRUNC_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_TRUNC_HPP
3 
6 #include <boost/math/special_functions/trunc.hpp>
7 #include <limits>
8 
9 namespace stan {
10  namespace math {
11 
19  inline double trunc(double x) {
20  if (is_nan(x))
21  return std::numeric_limits<double>::quiet_NaN();
23  }
24 
32  inline double trunc(int x) {
33  return trunc(static_cast<double>(x));
34  }
35 
36  }
37 }
38 #endif
var trunc(const var &a)
Returns the truncatation of the specified variable (C99).
Definition: trunc.hpp:55
fvar< T > trunc(const fvar< T > &x)
Return the nearest integral value that is not larger in magnitude than the specified argument...
Definition: trunc.hpp:19
boost::math::policies::policy< boost::math::policies::overflow_error< boost::math::policies::errno_on_error >, boost::math::policies::pole_error< boost::math::policies::errno_on_error > > boost_policy_t
Boost policy that overrides the defaults to match the built-in C++ standard library functions...
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.