2#ifndef TETL_CMATH_RINT_HPP
3#define TETL_CMATH_RINT_HPP
15[[nodiscard]]
constexpr auto rint_fallback(T
arg)
noexcept -> T
17 if constexpr (
sizeof(T) <=
sizeof(long)) {
18 return static_cast<T
>(
static_cast<long>(
arg));
20 return static_cast<T
>(
static_cast<long long>(
arg));
25[[nodiscard]]
constexpr auto rint_impl(T
arg)
noexcept -> T
29#if __has_builtin(__builtin_rintf)
30 return __builtin_rintf(
arg);
34#if __has_builtin(__builtin_rint)
35 return __builtin_rint(
arg);
39#if __has_builtin(__builtin_rintl)
40 return __builtin_rintl(
arg);
44 return rint_fallback(
arg);
52[[nodiscard]]
constexpr auto rint(
float arg)
noexcept ->
float {
return detail::rint_impl(
arg); }
57[[nodiscard]]
constexpr auto rintf(
float arg)
noexcept ->
float {
return detail::rint_impl(
arg); }
62[[nodiscard]]
constexpr auto rint(
double arg)
noexcept ->
double {
return detail::rint_impl(
arg); }
67[[nodiscard]]
constexpr auto rint(
long double arg)
noexcept ->
long double {
return detail::rint_impl(
arg); }
72[[nodiscard]]
constexpr auto rintl(
long double arg)
noexcept ->
long double {
return detail::rint_impl(
arg); }
78[[nodiscard]]
constexpr auto rint(T
arg)
noexcept ->
double
80 return rint(
static_cast<double>(
arg));
constexpr auto rintl(long double arg) noexcept -> long double
Rounds the floating-point argument arg to an integer value (in floating-point format),...
Definition rint.hpp:72
constexpr auto rint(float arg) noexcept -> float
Rounds the floating-point argument arg to an integer value (in floating-point format),...
Definition rint.hpp:52
constexpr auto rintf(float arg) noexcept -> float
Rounds the floating-point argument arg to an integer value (in floating-point format),...
Definition rint.hpp:57
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