File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,19 +8,34 @@ namespace stan {
88namespace math {
99
1010/* *
11- * Returns true if the input is NaN and false otherwise.
11+ * Tests if the input is Not a Number (NaN)
12+ *
13+ * Integer specialization, always return false.
14+ *
15+ * @tparam T Integer type.
16+ * @param x Value to test.
17+ * @return <code>false</code>.
18+ */
19+ template <typename T, require_integral_t <T>* = nullptr >
20+ inline bool is_nan (T x) {
21+ return false ;
22+ }
23+
24+ /* *
25+ * Tests if the input is Not a Number (NaN)
1226 *
1327 * Delegates to <code>std::isnan</code>.
1428 *
29+ * @tparam T Floating point type.
1530 * @param x Value to test.
1631 * @return <code>true</code> if the value is NaN.
1732 */
18- template <typename T, typename = require_arithmetic_t <T>>
33+ template <typename T, require_floating_point_t <T>* = nullptr >
1934inline bool is_nan (T x) {
2035 return std::isnan (x);
2136}
2237
23- template <typename T, typename = require_eigen_t <T>>
38+ template <typename T, require_eigen_t <T>* = nullptr >
2439inline bool is_nan (const T& x) {
2540 return x.hasNan ();
2641}
You can’t perform that action at this time.
0 commit comments