5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MATH_ABS_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_MATH_ABS_HPP_
15#include "arene/base/stdlib_choice/enable_if.hpp"
16#include "arene/base/stdlib_choice/is_floating_point.hpp"
17#include "arene/base/stdlib_choice/is_integral.hpp"
18#include "arene/base/stdlib_choice/is_signed.hpp"
19#include "arene/base/stdlib_choice/numeric_limits.hpp"
27#if ARENE_IS_ON(ARENE_HAS_BUILTIN_FABS) && ARENE_IS_ON(ARENE_HAS_BUILTIN_FABSF)
28#include "arene/base/math/detail/builtin_abs_float.hpp"
30#include "arene/base/math/detail/custom_abs_float.hpp"
46constexpr auto abs(Number value)
noexcept -> Number {
48 constexpr Number zero{
static_cast<Number
>(0)};
51 return static_cast<Number
>(-value);
71constexpr auto abs(Number value)
noexcept -> Number {
80template <
typename Number, constra
ints<std::enable_if_t<(std::is_
floating_po
int<Number>::value)> > =
nullptr>
81constexpr auto abs(Number value)
noexcept -> Number {
82 return math::detail::abs(value);
static constexpr auto min() noexcept -> T
The minimum finite value; the minimum positive normalized value for floating point types.
Definition numeric_limits.hpp:235
#define ARENE_PRECONDITION(condition)
Check that a precondition holds, and terminate the application if it does not.
Definition contract.hpp:150
Definition accumulate.hpp:37
constexpr auto abs(Number value) noexcept -> Number
Calculate the absolute value of a number.
Definition abs.hpp:46
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41