4#ifndef TETL_CMATH_LGAMMA_HPP
5#define TETL_CMATH_LGAMMA_HPP
7#include <etl/_3rd_party/gcem/gcem.hpp>
8#include <etl/_concepts/integral.hpp>
9#include <etl/_type_traits/is_constant_evaluated.hpp>
15inline constexpr struct lgamma {
16 template <
typename Float>
17 [[nodiscard]]
constexpr auto operator()(Float arg)
const noexcept -> Float
20#if __has_builtin(__builtin_lgammaf)
21 if constexpr (etl::same_as<Float,
float>) {
22 return __builtin_lgammaf(arg);
25#if __has_builtin(__builtin_lgamma)
26 if constexpr (etl::same_as<Float,
double>) {
27 return __builtin_lgamma(arg);
31 return etl::detail::gcem::lgamma(arg);
44 return etl::detail::lgamma(arg);
51 return etl::detail::lgamma(arg);
58 return etl::detail::lgamma(arg);
65 return etl::detail::lgamma(arg);
72 return etl::detail::lgamma(arg);
78[[nodiscard]]
constexpr auto lgamma(T arg)
noexcept ->
double
80 return etl::detail::lgamma(
static_cast<
double>(arg));
constexpr auto lgamma(long double arg) noexcept -> long double
Computes the natural logarithm of the absolute value of the gamma function of arg.
Definition lgamma.hpp:63
constexpr auto lgamma(double arg) noexcept -> double
Computes the natural logarithm of the absolute value of the gamma function of arg.
Definition lgamma.hpp:56
constexpr auto lgamma(T arg) noexcept -> double
Computes the natural logarithm of the absolute value of the gamma function of arg.
Definition lgamma.hpp:78
constexpr auto lgamma(float arg) noexcept -> float
Definition lgamma.hpp:42
constexpr auto lgammaf(float arg) noexcept -> float
Computes the natural logarithm of the absolute value of the gamma function of arg.
Definition lgamma.hpp:49
constexpr auto lgammal(long double arg) noexcept -> long double
Computes the natural logarithm of the absolute value of the gamma function of arg.
Definition lgamma.hpp:70
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