tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
sinh.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_SINH_HPP
5#define TETL_CMATH_SINH_HPP
6
7#include <etl/_3rd_party/gcem/gcem.hpp>
8#include <etl/_concepts/integral.hpp>
9#include <etl/_type_traits/is_constant_evaluated.hpp>
10
11namespace etl {
12
13namespace detail {
14
15inline constexpr struct sinh {
16 template <typename Float>
17 [[nodiscard]] constexpr auto operator()(Float arg) const noexcept -> Float
18 {
20#if __has_builtin(__builtin_sinhf)
21 if constexpr (etl::same_as<Float, float>) {
22 return __builtin_sinhf(arg);
23 }
24#endif
25#if __has_builtin(__builtin_sinh)
26 if constexpr (etl::same_as<Float, double>) {
27 return __builtin_sinh(arg);
28 }
29#endif
30 }
31 return etl::detail::gcem::sinh(arg);
32 }
33} sinh;
34
35} // namespace detail
36
37/// \ingroup cmath
38/// @{
39
40/// Computes the hyperbolic sine of arg
41/// \details https://en.cppreference.com/w/cpp/numeric/math/sinh
42[[nodiscard]] constexpr auto sinh(float arg) noexcept -> float
43{
44 return etl::detail::sinh(arg);
45}
46
47/// Computes the hyperbolic sine of arg
48/// \details https://en.cppreference.com/w/cpp/numeric/math/sinh
49[[nodiscard]] constexpr auto sinhf(float arg) noexcept -> float
50{
51 return etl::detail::sinh(arg);
52}
53
54/// Computes the hyperbolic sine of arg
55/// \details https://en.cppreference.com/w/cpp/numeric/math/sinh
56[[nodiscard]] constexpr auto sinh(double arg) noexcept -> double
57{
58 return etl::detail::sinh(arg);
59}
60
61/// Computes the hyperbolic sine of arg
62/// \details https://en.cppreference.com/w/cpp/numeric/math/sinh
63[[nodiscard]] constexpr auto sinh(long double arg) noexcept -> long double
64{
65 return etl::detail::sinh(arg);
66}
67
68/// Computes the hyperbolic sine of arg
69/// \details https://en.cppreference.com/w/cpp/numeric/math/sinh
70[[nodiscard]] constexpr auto sinhl(long double arg) noexcept -> long double
71{
72 return etl::detail::sinh(arg);
73}
74
75/// Computes the hyperbolic sine of arg
76/// \details https://en.cppreference.com/w/cpp/numeric/math/sinh
77template <integral T>
78[[nodiscard]] constexpr auto sinh(T arg) noexcept -> double
79{
80 return etl::detail::sinh(static_cast<double>(arg));
81}
82
83/// @}
84
85} // namespace etl
86
87#endif // TETL_CMATH_SINH_HPP
constexpr auto sinh(float arg) noexcept -> float
Definition sinh.hpp:42
constexpr auto sinh(double arg) noexcept -> double
Computes the hyperbolic sine of arg.
Definition sinh.hpp:56
constexpr auto sinh(long double arg) noexcept -> long double
Computes the hyperbolic sine of arg.
Definition sinh.hpp:63
constexpr auto sinh(T arg) noexcept -> double
Computes the hyperbolic sine of arg.
Definition sinh.hpp:78
constexpr auto sinhl(long double arg) noexcept -> long double
Computes the hyperbolic sine of arg.
Definition sinh.hpp:70
constexpr auto sinhf(float arg) noexcept -> float
Computes the hyperbolic sine of arg.
Definition sinh.hpp:49
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