Automatic Differentiation
 
Loading...
Searching...
No Matches
is_nan.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_IS_NAN_HPP
2#define STAN_MATH_PRIM_FUN_IS_NAN_HPP
3
5#include <cmath>
6
7namespace stan {
8namespace math {
9
19template <typename T, require_integral_t<T>* = nullptr>
20inline bool is_nan(T x) {
21 return false;
22}
23
33template <typename T, require_floating_point_t<T>* = nullptr>
34inline bool is_nan(T x) {
35 return std::isnan(x);
36}
37
38template <typename T, require_eigen_t<T>* = nullptr>
39inline bool is_nan(const T& x) {
40 return x.hasNan();
41}
42
43} // namespace math
44} // namespace stan
45
46#endif
bool is_nan(T &&x)
Returns 1 if the input's value is NaN and 0 otherwise.
Definition is_nan.hpp:22
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
bool isnan(const stan::math::var &a)
Checks if the given number is NaN.
Definition std_isnan.hpp:18