2#ifndef TETL_CMATH_LRINT_HPP
3#define TETL_CMATH_LRINT_HPP
14template <
typename T,
typename U>
15[[nodiscard]]
constexpr auto lrint_fallback(U
arg)
noexcept -> T
17 return static_cast<T
>(
arg);
21[[nodiscard]]
constexpr auto lrint_impl(T
arg)
noexcept ->
long
25#if __has_builtin(__builtin_lrintf)
26 return __builtin_lrintf(
arg);
30#if __has_builtin(__builtin_lrint)
31 return __builtin_lrint(
arg);
35#if __has_builtin(__builtin_lrintl)
36 return __builtin_lrintl(
arg);
40 return lrint_fallback<long>(
arg);
44[[nodiscard]]
constexpr auto llrint_impl(T
arg)
noexcept ->
long long
48#if __has_builtin(__builtin_llrintf)
49 return __builtin_llrintf(
arg);
53#if __has_builtin(__builtin_llrint)
54 return __builtin_llrint(
arg);
58#if __has_builtin(__builtin_llrintl)
59 return __builtin_llrintl(
arg);
63 return lrint_fallback<long long>(
arg);
70[[nodiscard]]
constexpr auto lrint(
float arg)
noexcept ->
long {
return detail::lrint_impl(
arg); }
74[[nodiscard]]
constexpr auto lrintf(
float arg)
noexcept ->
long {
return detail::lrint_impl(
arg); }
78[[nodiscard]]
constexpr auto lrint(
double arg)
noexcept ->
long {
return detail::lrint_impl(
arg); }
82[[nodiscard]]
constexpr auto lrint(
long double arg)
noexcept ->
long {
return detail::lrint_impl(
arg); }
86[[nodiscard]]
constexpr auto lrintl(
long double arg)
noexcept ->
long {
return detail::lrint_impl(
arg); }
91[[nodiscard]]
constexpr auto lrint(T
arg)
noexcept ->
long
93 return lrint(
static_cast<double>(
arg));
98[[nodiscard]]
constexpr auto llrint(
float arg)
noexcept ->
long long {
return detail::llrint_impl(
arg); }
102[[nodiscard]]
constexpr auto llrintf(
float arg)
noexcept ->
long long {
return detail::llrint_impl(
arg); }
106[[nodiscard]]
constexpr auto llrint(
double arg)
noexcept ->
long long {
return detail::llrint_impl(
arg); }
110[[nodiscard]]
constexpr auto llrint(
long double arg)
noexcept ->
long long {
return detail::llrint_impl(
arg); }
114[[nodiscard]]
constexpr auto llrintl(
long double arg)
noexcept ->
long long {
return detail::llrint_impl(
arg); }
119[[nodiscard]]
constexpr auto llrint(T
arg)
noexcept ->
long long
constexpr auto llrintf(float arg) noexcept -> long long
Rounds the floating-point argument arg to an integer value, using the current rounding mode.
Definition lrint.hpp:102
constexpr auto llrintl(long double arg) noexcept -> long long
Rounds the floating-point argument arg to an integer value, using the current rounding mode.
Definition lrint.hpp:114
constexpr auto lrintf(float arg) noexcept -> long
Rounds the floating-point argument arg to an integer value, using the current rounding mode.
Definition lrint.hpp:74
constexpr auto llrint(float arg) noexcept -> long long
Rounds the floating-point argument arg to an integer value, using the current rounding mode.
Definition lrint.hpp:98
constexpr auto lrint(float arg) noexcept -> long
Rounds the floating-point argument arg to an integer value, using the current rounding mode.
Definition lrint.hpp:70
constexpr auto lrintl(long double arg) noexcept -> long
Rounds the floating-point argument arg to an integer value, using the current rounding mode.
Definition lrint.hpp:86
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
constexpr bool is_same_v
Definition is_same.hpp:11