5#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NUMERIC_LIMITS_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NUMERIC_LIMITS_HPP_
27#include "arene/base/constraints.hpp"
28#include "stdlib/include/stdlib_detail/cstdint.hpp"
29#include "stdlib/include/stdlib_detail/enable_if.hpp"
30#include "stdlib/include/stdlib_detail/is_signed.hpp"
35#if defined(__FAST_MATH__)
36#error "Fast math not supported as does not conform to IEC559"
40#if defined(__FINITE_MATH_ONLY__
) && (__FINITE_MATH_ONLY__
== 1
)
41#error "Finite math only not supported does not conform to IEC559"
46#if defined(__NO_TRAPPING_MATH__) && (__NO_TRAPPING_MATH__ == 1
)
47#error "Disabling trapping math not supported as it does not conform to IEC559"
52#if defined(__GCC_IEC_559) && (__GCC_IEC_559 == 0
)
53#error "Unsupported floating point mode that does not conform to IEC559 enabled"
63static_assert(
CHAR_BIT == 8,
"Values only correct for platforms with 8-bit bytes");
230 static constexpr auto max()
noexcept -> T {
return T(); }
235 static constexpr auto min()
noexcept -> T {
return T(); }
238 static constexpr auto lowest()
noexcept -> T {
return T(); }
243 static constexpr auto epsilon()
noexcept -> T {
return T(); }
249 static constexpr auto infinity()
noexcept -> T {
return T(); }
253 static constexpr auto quiet_NaN()
noexcept -> T {
return T(); }
261 static constexpr auto denorm_min()
noexcept -> T {
return T(); }
285 static constexpr int digits{
static_cast<
int>(
339 static constexpr auto max()
noexcept ->
T {
345 static constexpr auto min()
noexcept ->
T {
350 static constexpr auto lowest()
noexcept ->
T {
return min(); }
355 static constexpr auto epsilon()
noexcept ->
T {
return T{}; }
361 static constexpr auto infinity()
noexcept ->
T {
return T{}; }
440 static constexpr auto max()
noexcept ->
bool {
return true; }
443 static constexpr auto min()
noexcept ->
bool {
return false; }
446 static constexpr auto lowest()
noexcept ->
bool {
return min(); }
451 static constexpr auto epsilon()
noexcept ->
bool {
return false; }
454 static constexpr auto round_error()
noexcept ->
bool {
return false; }
457 static constexpr auto infinity()
noexcept ->
bool {
return false; }
461 static constexpr auto quiet_NaN()
noexcept ->
bool {
return false; }
469 static constexpr auto denorm_min()
noexcept ->
bool {
return false; }
544 static constexpr auto max()
noexcept ->
float {
return FLT_MAX; }
547 static constexpr auto min()
noexcept ->
float {
return FLT_MIN; }
587 static_assert(
FLT_MANT_DIG < (
sizeof(
unsigned long long) *
CHAR_BIT),
"Ensure shift doesn't overflow");
668 static constexpr auto max()
noexcept ->
double {
return DBL_MAX; }
674 static constexpr auto min()
noexcept ->
double {
return DBL_MIN; }
721 static_assert(
DBL_MANT_DIG < (
sizeof(
unsigned long long) *
CHAR_BIT),
"Ensure shift doesn't overflow");
Implementation template for numeric_limits.
Definition numeric_limits.hpp:167
static constexpr bool has_signaling_NaN
For floating point types, true if the type has a representation of a signaling "Not-a-Number",...
Definition numeric_limits.hpp:214
static constexpr int digits10
The maximum number of base-10 digits that can be completely represented in values of the type.
Definition numeric_limits.hpp:182
static constexpr auto denorm_min() noexcept -> T
For floating point types, the minimum positive denormalized value. If the representation has no denor...
Definition numeric_limits.hpp:261
static constexpr bool has_quiet_NaN
For floating point types, true if the type has a representation of a quiet (non-signaling) "Not-a-Num...
Definition numeric_limits.hpp:210
static constexpr auto min() noexcept -> T
The minimum finite value; the minimum positive normalized value for floating point types.
Definition numeric_limits.hpp:235
static constexpr float_denorm_style has_denorm
For floating point types, an indicator of whether the type has a representation of denormalized value...
Definition numeric_limits.hpp:216
static constexpr auto lowest() noexcept -> T
The minimum finite value such that there is no finite value y such that y<lowest()
Definition numeric_limits.hpp:238
static constexpr bool is_iec559
For floating point types, true if the type adheres to the IEC559 standard, otherwise false.
Definition numeric_limits.hpp:221
static constexpr auto infinity() noexcept -> T
For floating point types where has_infinity is true, a representation of positive infinity.
Definition numeric_limits.hpp:249
static constexpr auto signaling_NaN() noexcept -> T
For floating point types where has_signaling_NaN is true, a representation of a signaling NaN.
Definition numeric_limits.hpp:257
static constexpr int max_exponent10
For floating point types, the maximum positive integer such that 10 raised to the power of one less t...
Definition numeric_limits.hpp:204
static constexpr bool has_denorm_loss
For floating point types, true if loss of accuracy is detected as a denormalization loss rather than ...
Definition numeric_limits.hpp:219
static constexpr bool traps
true if there are trap representations of this type, otherwise false
Definition numeric_limits.hpp:188
static constexpr auto quiet_NaN() noexcept -> T
For floating point types where has_quiet_NaN is true, a representation of a quiet NaN.
Definition numeric_limits.hpp:253
static constexpr int digits
The number of radix digits in the representation, ignoring any sign bit.
Definition numeric_limits.hpp:180
static constexpr auto round_error() noexcept -> T
For floating point types, the maximum rounding error.
Definition numeric_limits.hpp:246
static constexpr int min_exponent
For floating point types, the minimum negative integer such that radix raised to the power of one les...
Definition numeric_limits.hpp:195
static constexpr int min_exponent10
For floating point types, the minimum negative integer such that 10 raised to the power of one less t...
Definition numeric_limits.hpp:198
static constexpr bool is_bounded
true if the set of values representable by the type is bounded, otherwise false
Definition numeric_limits.hpp:184
static constexpr auto epsilon() noexcept -> T
For floating point types, the epsilon value: the difference between 1 and the least representable val...
Definition numeric_limits.hpp:243
static constexpr bool is_modulo
true if the set of values representable by the type is modulo, otherwise false
Definition numeric_limits.hpp:186
static constexpr bool is_specialized
Is this a specialization for which the other values are meaningful? true if so, false otherwise.
Definition numeric_limits.hpp:170
static constexpr bool is_integer
Is the type an integral type? true if so, false otherwise.
Definition numeric_limits.hpp:172
static constexpr bool has_infinity
For floating point types, true if the type has a representation of positive infinity,...
Definition numeric_limits.hpp:206
static constexpr float_round_style round_style
For floating point types, an indicator of the default rounding style.
Definition numeric_limits.hpp:225
static constexpr bool is_exact
Is the type an exact type? true if so, false otherwise.
Definition numeric_limits.hpp:174
static constexpr bool is_signed
Is the type a signed type? true if so, false otherwise.
Definition numeric_limits.hpp:176
static constexpr int max_digits10
For floating point types, the number of base-10 digits required to ensure that values which differ ca...
Definition numeric_limits.hpp:192
static constexpr int radix
The base used for the representation.
Definition numeric_limits.hpp:178
static constexpr bool tinyness_before
For floating point types, true if tinyness is detected before rounding, otherwise false.
Definition numeric_limits.hpp:223
static constexpr auto max() noexcept -> T
The maximum finite value.
Definition numeric_limits.hpp:230
static constexpr int max_exponent
For floating point types, the maximum positive integer such that radix raised to the power of one les...
Definition numeric_limits.hpp:201
Traits class to provide information about the representation of arithmetic types.
Definition numeric_limits.hpp:745
Definition numeric_limits.hpp:93
constexpr int log10_2_den
Denominator for log10(2) as a fraction.
Definition numeric_limits.hpp:478
constexpr int log10_2_num
Numerator for log10(2) as a fraction.
Definition numeric_limits.hpp:476
float_round_style
Enumeration describing possible rounding styles.
Definition numeric_limits.hpp:67
@ round_toward_zero
Round towards zero.
Definition numeric_limits.hpp:71
@ round_toward_infinity
Round towards positive infinity.
Definition numeric_limits.hpp:75
@ round_to_nearest
Round towards nearest.
Definition numeric_limits.hpp:73
@ round_toward_neg_infinity
Round towards negative infinity.
Definition numeric_limits.hpp:77
@ round_indeterminate
Rounding is indeterminable.
Definition numeric_limits.hpp:69
float_denorm_style
Enumeration describing possible denormalized value representation properties.
Definition numeric_limits.hpp:83
@ denorm_present
This type has denormalized values.
Definition numeric_limits.hpp:89
@ denorm_indeterminate
It cannot be determined if this type has denormalized values.
Definition numeric_limits.hpp:85
@ denorm_absent
This type has no denormalized values.
Definition numeric_limits.hpp:87
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition result.hpp:1827
static constexpr int digits10
The number of decimal digits.
Definition numeric_limits.hpp:103
static constexpr int8_t signed_max
The maximum value of a signed integer with this size.
Definition numeric_limits.hpp:109
static constexpr int unsigned_digits10
The number of decimal digits when unsigned.
Definition numeric_limits.hpp:105
static constexpr uint8_t unsigned_max
The maximum value of an unsigned integer with this size.
Definition numeric_limits.hpp:111
static constexpr int8_t signed_min
The minimum value of a signed integer with this size.
Definition numeric_limits.hpp:107
static constexpr int16_t signed_min
The minimum value of a signed integer with this size.
Definition numeric_limits.hpp:122
static constexpr int digits10
The number of decimal digits.
Definition numeric_limits.hpp:118
static constexpr int16_t signed_max
The minimum value of a signed integer with this size.
Definition numeric_limits.hpp:124
static constexpr uint16_t unsigned_max
The maximum value of an unsigned integer with this size.
Definition numeric_limits.hpp:126
static constexpr int unsigned_digits10
The number of decimal digits when unsigned.
Definition numeric_limits.hpp:120
static constexpr uint32_t unsigned_max
The maximum value of an unsigned integer with this size.
Definition numeric_limits.hpp:143
static constexpr int digits10
The number of decimal digits.
Definition numeric_limits.hpp:133
static constexpr int32_t signed_min
The minimum value of a signed integer with this size.
Definition numeric_limits.hpp:141
static constexpr int32_t signed_max
The maximum value of a signed integer with this size.
Definition numeric_limits.hpp:138
static constexpr int unsigned_digits10
The number of decimal digits when unsigned.
Definition numeric_limits.hpp:135
static constexpr int unsigned_digits10
The number of decimal digits when unsigned.
Definition numeric_limits.hpp:153
static constexpr int64_t signed_max
The maximum value of a signed integer with this size.
Definition numeric_limits.hpp:156
static constexpr uint64_t unsigned_max
The maximum value of an unsigned integer with this size.
Definition numeric_limits.hpp:161
static constexpr int64_t signed_min
The minimum value of a signed integer with this size.
Definition numeric_limits.hpp:159
static constexpr int digits10
The number of decimal digits.
Definition numeric_limits.hpp:151