tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
isnan.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CMATH_ISNAN_HPP
4#define TETL_CMATH_ISNAN_HPP
5
6#include <etl/_config/all.hpp>
7
10
11namespace etl {
12
16[[nodiscard]] constexpr auto isnan(float arg) -> bool
17{
18#if __has_builtin(__builtin_isnanf) or defined(TETL_COMPILER_GCC)
19 return __builtin_isnanf(arg);
20#else
21 return arg != arg;
22#endif
23}
24
26[[nodiscard]] constexpr auto isnan(double arg) -> bool
27{
28#if __has_builtin(__builtin_isnan) or defined(TETL_COMPILER_GCC)
29 return __builtin_isnan(arg) != 0;
30#else
31 return arg != arg;
32#endif
33}
34
36[[nodiscard]] constexpr auto isnan(long double arg) -> bool
37{
38#if __has_builtin(__builtin_isnanl) or defined(TETL_COMPILER_GCC)
39 return __builtin_isnanl(arg);
40#else
41 return arg != arg;
42#endif
43}
44
48template <integral Int>
49[[nodiscard]] constexpr auto isnan(Int arg) -> bool
50{
51 return isnan(static_cast<double>(arg));
52}
53
54} // namespace etl
55
56#endif // TETL_CMATH_ISNAN_HPP
constexpr auto arg(complex< T > const &z) noexcept -> T
Definition arg.hpp:15
Definition adjacent_find.hpp:8
constexpr auto isnan(half arg) noexcept -> bool
Definition half.hpp:60