tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
acosh.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CMATH_ACOSH_HPP
4#define TETL_CMATH_ACOSH_HPP
5
6#include <etl/_config/all.hpp>
7
8#include <etl/_3rd_party/gcem/gcem.hpp>
12
13namespace etl {
14
15namespace detail {
16
17inline constexpr struct acosh {
18 template <typename Float>
19 [[nodiscard]] constexpr auto operator()(Float arg) const noexcept -> Float
20 {
21#if not defined(__AVR__)
22 if (not is_constant_evaluated()) {
23 #if __has_builtin(__builtin_acoshf)
24 if constexpr (etl::same_as<Float, float>) {
25 return __builtin_acoshf(arg);
26 }
27 #endif
28 #if __has_builtin(__builtin_acosh)
29 if constexpr (etl::same_as<Float, double>) {
30 return __builtin_acosh(arg);
31 }
32 #endif
33 }
34#endif
35 return etl::detail::gcem::acosh(arg);
36 }
37} acosh;
38
39} // namespace detail
40
43
46[[nodiscard]] constexpr auto acosh(float arg) noexcept -> float { return etl::detail::acosh(arg); }
47[[nodiscard]] constexpr auto acoshf(float arg) noexcept -> float { return etl::detail::acosh(arg); }
48[[nodiscard]] constexpr auto acosh(double arg) noexcept -> double { return etl::detail::acosh(arg); }
49[[nodiscard]] constexpr auto acosh(long double arg) noexcept -> long double { return etl::detail::acosh(arg); }
50[[nodiscard]] constexpr auto acoshl(long double arg) noexcept -> long double { return etl::detail::acosh(arg); }
51[[nodiscard]] constexpr auto acosh(integral auto arg) noexcept -> double { return etl::detail::acosh(double(arg)); }
52
54
55} // namespace etl
56
57#endif // TETL_CMATH_ACOSH_HPP
The concept integral<T> is satisfied if and only if T is an integral type.
Definition integral.hpp:13
constexpr auto acoshl(long double arg) noexcept -> long double
Computes the inverse hyperbolic cosine of arg.
Definition acosh.hpp:50
constexpr auto acosh(float arg) noexcept -> float
Computes the inverse hyperbolic cosine of arg.
Definition acosh.hpp:46
constexpr auto acoshf(float arg) noexcept -> float
Computes the inverse hyperbolic cosine of arg.
Definition acosh.hpp:47
constexpr auto arg(complex< T > const &z) noexcept -> T
Definition arg.hpp:15
Definition adjacent_find.hpp:8
constexpr auto is_constant_evaluated() noexcept -> bool
Detects whether the function call occurs within a constant-evaluated context. Returns true if the eva...
Definition is_constant_evaluated.hpp:16