tmp/tmpmu81vu3s/{from.md → to.md}
RENAMED
|
@@ -3,31 +3,33 @@
|
|
| 3 |
All members shall be provided for all specializations. However, many
|
| 4 |
values are only required to be meaningful under certain conditions (for
|
| 5 |
example, `epsilon()` is only meaningful if `is_integer` is `false`). Any
|
| 6 |
value that is not “meaningful” shall be set to 0 or `false`.
|
| 7 |
|
|
|
|
|
|
|
| 8 |
``` cpp
|
| 9 |
namespace std {
|
| 10 |
template<> class numeric_limits<float> {
|
| 11 |
public:
|
| 12 |
static constexpr bool is_specialized = true;
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
static constexpr int digits = 24;
|
| 19 |
static constexpr int digits10 = 6;
|
| 20 |
static constexpr int max_digits10 = 9;
|
| 21 |
|
| 22 |
static constexpr bool is_signed = true;
|
| 23 |
static constexpr bool is_integer = false;
|
| 24 |
static constexpr bool is_exact = false;
|
| 25 |
|
| 26 |
static constexpr int radix = 2;
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
static constexpr int min_exponent = -125;
|
| 31 |
static constexpr int min_exponent10 = - 37;
|
| 32 |
static constexpr int max_exponent = +128;
|
| 33 |
static constexpr int max_exponent10 = + 38;
|
|
@@ -36,14 +38,14 @@ namespace std {
|
|
| 36 |
static constexpr bool has_quiet_NaN = true;
|
| 37 |
static constexpr bool has_signaling_NaN = true;
|
| 38 |
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 39 |
static constexpr bool has_denorm_loss = false;
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
|
| 46 |
static constexpr bool is_iec559 = true;
|
| 47 |
static constexpr bool is_bounded = true;
|
| 48 |
static constexpr bool is_modulo = false;
|
| 49 |
static constexpr bool traps = true;
|
|
@@ -52,10 +54,12 @@ namespace std {
|
|
| 52 |
static constexpr float_round_style round_style = round_to_nearest;
|
| 53 |
};
|
| 54 |
}
|
| 55 |
```
|
| 56 |
|
|
|
|
|
|
|
| 57 |
The specialization for `bool` shall be provided as follows:
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
namespace std {
|
| 61 |
template<> class numeric_limits<bool> {
|
|
|
|
| 3 |
All members shall be provided for all specializations. However, many
|
| 4 |
values are only required to be meaningful under certain conditions (for
|
| 5 |
example, `epsilon()` is only meaningful if `is_integer` is `false`). Any
|
| 6 |
value that is not “meaningful” shall be set to 0 or `false`.
|
| 7 |
|
| 8 |
+
[*Example 1*:
|
| 9 |
+
|
| 10 |
``` cpp
|
| 11 |
namespace std {
|
| 12 |
template<> class numeric_limits<float> {
|
| 13 |
public:
|
| 14 |
static constexpr bool is_specialized = true;
|
| 15 |
|
| 16 |
+
static constexpr float min() noexcept { return 1.17549435E-38F; }
|
| 17 |
+
static constexpr float max() noexcept { return 3.40282347E+38F; }
|
| 18 |
+
static constexpr float lowest() noexcept { return -3.40282347E+38F; }
|
| 19 |
|
| 20 |
static constexpr int digits = 24;
|
| 21 |
static constexpr int digits10 = 6;
|
| 22 |
static constexpr int max_digits10 = 9;
|
| 23 |
|
| 24 |
static constexpr bool is_signed = true;
|
| 25 |
static constexpr bool is_integer = false;
|
| 26 |
static constexpr bool is_exact = false;
|
| 27 |
|
| 28 |
static constexpr int radix = 2;
|
| 29 |
+
static constexpr float epsilon() noexcept { return 1.19209290E-07F; }
|
| 30 |
+
static constexpr float round_error() noexcept { return 0.5F; }
|
| 31 |
|
| 32 |
static constexpr int min_exponent = -125;
|
| 33 |
static constexpr int min_exponent10 = - 37;
|
| 34 |
static constexpr int max_exponent = +128;
|
| 35 |
static constexpr int max_exponent10 = + 38;
|
|
|
|
| 38 |
static constexpr bool has_quiet_NaN = true;
|
| 39 |
static constexpr bool has_signaling_NaN = true;
|
| 40 |
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 41 |
static constexpr bool has_denorm_loss = false;
|
| 42 |
|
| 43 |
+
static constexpr float infinity() noexcept { return value; }
|
| 44 |
+
static constexpr float quiet_NaN() noexcept { return value; }
|
| 45 |
+
static constexpr float signaling_NaN() noexcept { return value; }
|
| 46 |
+
static constexpr float denorm_min() noexcept { return min(); }
|
| 47 |
|
| 48 |
static constexpr bool is_iec559 = true;
|
| 49 |
static constexpr bool is_bounded = true;
|
| 50 |
static constexpr bool is_modulo = false;
|
| 51 |
static constexpr bool traps = true;
|
|
|
|
| 54 |
static constexpr float_round_style round_style = round_to_nearest;
|
| 55 |
};
|
| 56 |
}
|
| 57 |
```
|
| 58 |
|
| 59 |
+
— *end example*]
|
| 60 |
+
|
| 61 |
The specialization for `bool` shall be provided as follows:
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
namespace std {
|
| 65 |
template<> class numeric_limits<bool> {
|