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// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_CMATH_ACOSH_HPP
5#define TETL_CMATH_ACOSH_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_3rd_party/gcem/gcem.hpp>
10#include <etl/_concepts/integral.hpp>
11#include <etl/_concepts/same_as.hpp>
12#include <etl/_type_traits/is_constant_evaluated.hpp>
13
14namespace etl {
15
16namespace detail {
17
18inline constexpr struct acosh {
19 template <typename Float>
20 [[nodiscard]] constexpr auto operator()(Float arg) const noexcept -> Float
21 {
22#if not defined(__AVR__)
24 #if __has_builtin(__builtin_acoshf)
25 if constexpr (etl::same_as<Float, float>) {
26 return __builtin_acoshf(arg);
27 }
28 #endif
29 #if __has_builtin(__builtin_acosh)
30 if constexpr (etl::same_as<Float, double>) {
31 return __builtin_acosh(arg);
32 }
33 #endif
34 }
35#endif
36 return etl::detail::gcem::acosh(arg);
37 }
38} acosh;
39
40} // namespace detail
41
42/// \ingroup cmath
43/// @{
44
45/// Computes the inverse hyperbolic cosine of arg.
46/// \details https://en.cppreference.com/w/cpp/numeric/math/acosh
47[[nodiscard]] constexpr auto acosh(float arg) noexcept -> float
48{
49 return etl::detail::acosh(arg);
50}
51[[nodiscard]] constexpr auto acoshf(float arg) noexcept -> float
52{
53 return etl::detail::acosh(arg);
54}
55[[nodiscard]] constexpr auto acosh(double arg) noexcept -> double
56{
57 return etl::detail::acosh(arg);
58}
59[[nodiscard]] constexpr auto acosh(long double arg) noexcept -> long double
60{
61 return etl::detail::acosh(arg);
62}
63[[nodiscard]] constexpr auto acoshl(long double arg) noexcept -> long double
64{
65 return etl::detail::acosh(arg);
66}
67[[nodiscard]] constexpr auto acosh(integral auto arg) noexcept -> double
68{
69 return etl::detail::acosh(double(arg));
70}
71
72/// @}
73
74} // namespace etl
75
76#endif // TETL_CMATH_ACOSH_HPP
constexpr auto acosh(long double arg) noexcept -> long double
Definition acosh.hpp:59
constexpr auto acosh(double arg) noexcept -> double
Definition acosh.hpp:55
constexpr auto acoshl(long double arg) noexcept -> long double
Definition acosh.hpp:63
constexpr auto acosh(float arg) noexcept -> float
Definition acosh.hpp:47
constexpr auto acoshf(float arg) noexcept -> float
Definition acosh.hpp:51
Definition adjacent_find.hpp:9
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:17