4#ifndef TETL_CMATH_REMAINDER_HPP
5#define TETL_CMATH_REMAINDER_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 remainder {
16 template <
typename Float>
17 [[nodiscard]]
constexpr auto operator()(Float x, Float y)
const noexcept -> Float
20#if __has_builtin(__builtin_remainderf)
21 if constexpr (etl::same_as<Float,
float>) {
22 return __builtin_remainderf(x, y);
25#if __has_builtin(__builtin_remainder)
26 if constexpr (etl::same_as<Float,
double>) {
27 return __builtin_remainder(x, y);
31 return etl::detail::gcem::fmod(x, y);
44 return etl::detail::remainder(x, y);
51 return etl::detail::remainder(x, y);
58 return etl::detail::remainder(x, y);
65 return etl::detail::remainder(x, y);
72 return etl::detail::remainder(x, y);
77template <integral Int>
78[[nodiscard]]
constexpr auto remainder(Int x, Int y)
noexcept ->
double
80 return etl::detail::remainder(
static_cast<
double>(x),
static_cast<
double>(y));
constexpr auto remainder(Int x, Int y) noexcept -> double
Computes the remainder of the floating point division operation x/y.
Definition remainder.hpp:78
constexpr auto remainderf(float x, float y) noexcept -> float
Computes the remainder of the floating point division operation x/y.
Definition remainder.hpp:49
constexpr auto remainderl(long double x, long double y) noexcept -> long double
Computes the remainder of the floating point division operation x/y.
Definition remainder.hpp:70
constexpr auto remainder(double x, double y) noexcept -> double
Computes the remainder of the floating point division operation x/y.
Definition remainder.hpp:56
constexpr auto remainder(long double x, long double y) noexcept -> long double
Computes the remainder of the floating point division operation x/y.
Definition remainder.hpp:63
constexpr auto remainder(float x, float y) noexcept -> float
Definition remainder.hpp:42
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