Automatic Differentiation
 
Loading...
Searching...
No Matches
round.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_FUN_ROUND_HPP
2#define STAN_MATH_FWD_FUN_ROUND_HPP
3
9
10namespace stan {
11namespace math {
12
23template <typename T>
24inline fvar<T> round(const fvar<T>& x) {
25 return fvar<T>(round(x.val_), is_nan(x.val_) ? NOT_A_NUMBER : 0.0);
26}
27
28} // namespace math
29} // namespace stan
30#endif
static constexpr double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition constants.hpp:56
bool is_nan(T &&x)
Returns 1 if the input's value is NaN and 0 otherwise.
Definition is_nan.hpp:22
fvar< T > round(const fvar< T > &x)
Return the closest integer to the specified argument, with halfway cases rounded away from zero.
Definition round.hpp:24
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
Scalar val_
The value of this variable.
Definition fvar.hpp:49
This template class represents scalars used in forward-mode automatic differentiation,...
Definition fvar.hpp:40