4#ifndef TETL_CMATH_TRUNC_HPP
5#define TETL_CMATH_TRUNC_HPP
7#include <etl/_config/all.hpp>
9#include <etl/_3rd_party/gcem/gcem.hpp>
10#include <etl/_concepts/integral.hpp>
11#include <etl/_type_traits/is_constant_evaluated.hpp>
12#include <etl/_type_traits/is_same.hpp>
18[[nodiscard]]
constexpr auto trunc(T arg)
noexcept -> T
21 if constexpr (is_same_v<T,
float>) {
22#if __has_builtin(__builtin_truncf)
23 return __builtin_truncf(arg);
26 if constexpr (is_same_v<T,
double>) {
27#if __has_builtin(__builtin_trunc)
28 return __builtin_trunc(arg);
33 return detail::gcem::trunc(arg);
45 return detail::trunc(arg);
49 return detail::trunc(arg);
53 return detail::trunc(arg);
57 return detail::trunc(arg);
61 return detail::trunc(arg);
constexpr auto trunc(double arg) noexcept -> double
Definition trunc.hpp:51
constexpr auto trunc(float arg) noexcept -> float
Definition trunc.hpp:43
constexpr auto truncf(float arg) noexcept -> float
Definition trunc.hpp:47
constexpr auto trunc(long double arg) noexcept -> long double
Definition trunc.hpp:55
constexpr auto truncl(long double arg) noexcept -> long double
Definition trunc.hpp:59
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