pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
is_nan.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_IS_NAN_H
4#define pRC_CORE_VALUE_FUNCTIONS_IS_NAN_H
5
6#include <cmath>
7
9
10namespace pRC
11{
19 template<class T, If<IsFloat<T>> = 0>
20 static inline constexpr auto isNaN([[maybe_unused]] T const &a)
21 {
22#if !defined(__FINITE_MATH_ONLY__) || __FINITE_MATH_ONLY__ == 0
23 using std::isnan;
24 return isnan(a());
25#else
26 return false;
27#endif // ! __FINITE_MATH_ONLY__
28 }
29
40 template<class T, If<IsInteger<T>> = 0>
41 static inline constexpr auto isNaN(T const &)
42 {
43 return false;
44 }
45}
46#endif // pRC_CORE_VALUE_FUNCTIONS_IS_NAN_H
Definition cholesky.hpp:18
static constexpr auto isNaN(T const &a)
Checks if a Float is NaN.
Definition is_nan.hpp:20
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto isnan(BFloat16 const a)
Definition bfloat16.hpp:153