tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
isinf.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CMATH_ISINF_HPP
4#define TETL_CMATH_ISINF_HPP
5
6#include <etl/_config/all.hpp>
7
11
12namespace etl {
13
14namespace detail {
15
16inline constexpr struct isinf {
17 template <typename Float>
18 [[nodiscard]] constexpr auto operator()(Float arg) const -> bool
19 {
20#if __has_builtin(__builtin_isinf)
21 return __builtin_isinf(arg) != 0;
22#else
24#endif
25 }
26} isinf;
27
28} // namespace detail
29
33[[nodiscard]] constexpr auto isinf(float arg) -> bool { return etl::detail::isinf(arg); }
34
36[[nodiscard]] constexpr auto isinf(double arg) -> bool { return etl::detail::isinf(arg); }
37
39[[nodiscard]] constexpr auto isinf(long double arg) -> bool { return etl::detail::isinf(arg); }
40
42template <etl::integral Int>
43[[nodiscard]] constexpr auto isinf(Int arg) -> bool
44{
45 return etl::detail::isinf(static_cast<double>(arg));
46}
47
48} // namespace etl
49
50#endif // TETL_CMATH_ISINF_HPP
constexpr auto arg(complex< T > const &z) noexcept -> T
Definition arg.hpp:15
Definition adjacent_find.hpp:8
constexpr auto isinf(half arg) noexcept -> bool
Definition half.hpp:54
static constexpr auto infinity() noexcept -> T
Definition numeric_limits.hpp:46