tmp/tmpq0zw2bx7/{from.md → to.md}
RENAMED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class T> class numeric_limits {
|
| 6 |
public:
|
|
@@ -47,12 +51,434 @@ namespace std {
|
|
| 47 |
template<class T> class numeric_limits<volatile T>;
|
| 48 |
template<class T> class numeric_limits<const volatile T>;
|
| 49 |
}
|
| 50 |
```
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
The default `numeric_limits<T>` template shall have all members, but
|
| 53 |
with 0 or `false` values.
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
The value of each member of a specialization of `numeric_limits` on a
|
| 56 |
-
|
| 57 |
corresponding member of the specialization on the unqualified type `T`.
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Class template `numeric_limits` <a id="numeric.limits">[[numeric.limits]]</a>
|
| 2 |
+
|
| 3 |
+
The `numeric_limits` class template provides a C++program with
|
| 4 |
+
information about various properties of the implementation’s
|
| 5 |
+
representation of the arithmetic types.
|
| 6 |
|
| 7 |
``` cpp
|
| 8 |
namespace std {
|
| 9 |
template<class T> class numeric_limits {
|
| 10 |
public:
|
|
|
|
| 51 |
template<class T> class numeric_limits<volatile T>;
|
| 52 |
template<class T> class numeric_limits<const volatile T>;
|
| 53 |
}
|
| 54 |
```
|
| 55 |
|
| 56 |
+
For all members declared `static` `constexpr` in the `numeric_limits`
|
| 57 |
+
template, specializations shall define these values in such a way that
|
| 58 |
+
they are usable as constant expressions.
|
| 59 |
+
|
| 60 |
The default `numeric_limits<T>` template shall have all members, but
|
| 61 |
with 0 or `false` values.
|
| 62 |
|
| 63 |
+
Specializations shall be provided for each arithmetic type, both
|
| 64 |
+
floating-point and integer, including `bool`. The member
|
| 65 |
+
`is_specialized` shall be `true` for all such specializations of
|
| 66 |
+
`numeric_limits`.
|
| 67 |
+
|
| 68 |
The value of each member of a specialization of `numeric_limits` on a
|
| 69 |
+
cv-qualified type `cv T` shall be equal to the value of the
|
| 70 |
corresponding member of the specialization on the unqualified type `T`.
|
| 71 |
|
| 72 |
+
Non-arithmetic standard types, such as `complex<T>` ([[complex]]),
|
| 73 |
+
shall not have specializations.
|
| 74 |
+
|
| 75 |
+
#### `numeric_limits` members <a id="numeric.limits.members">[[numeric.limits.members]]</a>
|
| 76 |
+
|
| 77 |
+
Each member function defined in this subclause is signal-safe (
|
| 78 |
+
[[csignal.syn]]).
|
| 79 |
+
|
| 80 |
+
``` cpp
|
| 81 |
+
static constexpr T min() noexcept;
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Minimum finite value.[^3]
|
| 85 |
+
|
| 86 |
+
For floating types with subnormal numbers, returns the minimum positive
|
| 87 |
+
normalized value.
|
| 88 |
+
|
| 89 |
+
Meaningful for all specializations in which `is_bounded != false`, or
|
| 90 |
+
`is_bounded == false && is_signed == false`.
|
| 91 |
+
|
| 92 |
+
``` cpp
|
| 93 |
+
static constexpr T max() noexcept;
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
Maximum finite value.[^4]
|
| 97 |
+
|
| 98 |
+
Meaningful for all specializations in which `is_bounded != false`.
|
| 99 |
+
|
| 100 |
+
``` cpp
|
| 101 |
+
static constexpr T lowest() noexcept;
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
A finite value `x` such that there is no other finite value `y` where
|
| 105 |
+
`y < x`.[^5]
|
| 106 |
+
|
| 107 |
+
Meaningful for all specializations in which `is_bounded != false`.
|
| 108 |
+
|
| 109 |
+
``` cpp
|
| 110 |
+
static constexpr int digits;
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
Number of `radix` digits that can be represented without change.
|
| 114 |
+
|
| 115 |
+
For integer types, the number of non-sign bits in the representation.
|
| 116 |
+
|
| 117 |
+
For floating-point types, the number of `radix` digits in the
|
| 118 |
+
mantissa.[^6]
|
| 119 |
+
|
| 120 |
+
``` cpp
|
| 121 |
+
static constexpr int digits10;
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
Number of base 10 digits that can be represented without change.[^7]
|
| 125 |
+
|
| 126 |
+
Meaningful for all specializations in which `is_bounded != false`.
|
| 127 |
+
|
| 128 |
+
``` cpp
|
| 129 |
+
static constexpr int max_digits10;
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
Number of base 10 digits required to ensure that values which differ are
|
| 133 |
+
always differentiated.
|
| 134 |
+
|
| 135 |
+
Meaningful for all floating-point types.
|
| 136 |
+
|
| 137 |
+
``` cpp
|
| 138 |
+
static constexpr bool is_signed;
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
`true` if the type is signed.
|
| 142 |
+
|
| 143 |
+
Meaningful for all specializations.
|
| 144 |
+
|
| 145 |
+
``` cpp
|
| 146 |
+
static constexpr bool is_integer;
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
`true` if the type is integer.
|
| 150 |
+
|
| 151 |
+
Meaningful for all specializations.
|
| 152 |
+
|
| 153 |
+
``` cpp
|
| 154 |
+
static constexpr bool is_exact;
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
`true` if the type uses an exact representation. All integer types are
|
| 158 |
+
exact, but not all exact types are integer. For example, rational and
|
| 159 |
+
fixed-exponent representations are exact but not integer.
|
| 160 |
+
|
| 161 |
+
Meaningful for all specializations.
|
| 162 |
+
|
| 163 |
+
``` cpp
|
| 164 |
+
static constexpr int radix;
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
For floating types, specifies the base or radix of the exponent
|
| 168 |
+
representation (often 2).[^8]
|
| 169 |
+
|
| 170 |
+
For integer types, specifies the base of the representation.[^9]
|
| 171 |
+
|
| 172 |
+
Meaningful for all specializations.
|
| 173 |
+
|
| 174 |
+
``` cpp
|
| 175 |
+
static constexpr T epsilon() noexcept;
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
Machine epsilon: the difference between 1 and the least value greater
|
| 179 |
+
than 1 that is representable.[^10]
|
| 180 |
+
|
| 181 |
+
Meaningful for all floating-point types.
|
| 182 |
+
|
| 183 |
+
``` cpp
|
| 184 |
+
static constexpr T round_error() noexcept;
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
Measure of the maximum rounding error.[^11]
|
| 188 |
+
|
| 189 |
+
``` cpp
|
| 190 |
+
static constexpr int min_exponent;
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
Minimum negative integer such that `radix` raised to the power of one
|
| 194 |
+
less than that integer is a normalized floating-point number.[^12]
|
| 195 |
+
|
| 196 |
+
Meaningful for all floating-point types.
|
| 197 |
+
|
| 198 |
+
``` cpp
|
| 199 |
+
static constexpr int min_exponent10;
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
Minimum negative integer such that 10 raised to that power is in the
|
| 203 |
+
range of normalized floating-point numbers.[^13]
|
| 204 |
+
|
| 205 |
+
Meaningful for all floating-point types.
|
| 206 |
+
|
| 207 |
+
``` cpp
|
| 208 |
+
static constexpr int max_exponent;
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
Maximum positive integer such that `radix` raised to the power one less
|
| 212 |
+
than that integer is a representable finite floating-point number.[^14]
|
| 213 |
+
|
| 214 |
+
Meaningful for all floating-point types.
|
| 215 |
+
|
| 216 |
+
``` cpp
|
| 217 |
+
static constexpr int max_exponent10;
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
Maximum positive integer such that 10 raised to that power is in the
|
| 221 |
+
range of representable finite floating-point numbers.[^15]
|
| 222 |
+
|
| 223 |
+
Meaningful for all floating-point types.
|
| 224 |
+
|
| 225 |
+
``` cpp
|
| 226 |
+
static constexpr bool has_infinity;
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
`true` if the type has a representation for positive infinity.
|
| 230 |
+
|
| 231 |
+
Meaningful for all floating-point types.
|
| 232 |
+
|
| 233 |
+
Shall be `true` for all specializations in which `is_iec559 != false`.
|
| 234 |
+
|
| 235 |
+
``` cpp
|
| 236 |
+
static constexpr bool has_quiet_NaN;
|
| 237 |
+
```
|
| 238 |
+
|
| 239 |
+
`true` if the type has a representation for a quiet (non-signaling) “Not
|
| 240 |
+
a Number”.[^16]
|
| 241 |
+
|
| 242 |
+
Meaningful for all floating-point types.
|
| 243 |
+
|
| 244 |
+
Shall be `true` for all specializations in which `is_iec559 != false`.
|
| 245 |
+
|
| 246 |
+
``` cpp
|
| 247 |
+
static constexpr bool has_signaling_NaN;
|
| 248 |
+
```
|
| 249 |
+
|
| 250 |
+
`true` if the type has a representation for a signaling “Not a
|
| 251 |
+
Number”.[^17]
|
| 252 |
+
|
| 253 |
+
Meaningful for all floating-point types.
|
| 254 |
+
|
| 255 |
+
Shall be `true` for all specializations in which `is_iec559 != false`.
|
| 256 |
+
|
| 257 |
+
``` cpp
|
| 258 |
+
static constexpr float_denorm_style has_denorm;
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
`denorm_present` if the type allows subnormal values (variable number of
|
| 262 |
+
exponent bits)[^18], `denorm_absent` if the type does not allow
|
| 263 |
+
subnormal values, and `denorm_indeterminate` if it is indeterminate at
|
| 264 |
+
compile time whether the type allows subnormal values.
|
| 265 |
+
|
| 266 |
+
Meaningful for all floating-point types.
|
| 267 |
+
|
| 268 |
+
``` cpp
|
| 269 |
+
static constexpr bool has_denorm_loss;
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
`true` if loss of accuracy is detected as a denormalization loss, rather
|
| 273 |
+
than as an inexact result.[^19]
|
| 274 |
+
|
| 275 |
+
``` cpp
|
| 276 |
+
static constexpr T infinity() noexcept;
|
| 277 |
+
```
|
| 278 |
+
|
| 279 |
+
Representation of positive infinity, if available.[^20]
|
| 280 |
+
|
| 281 |
+
Meaningful for all specializations for which `has_infinity != false`.
|
| 282 |
+
Required in specializations for which `is_iec559 != false`.
|
| 283 |
+
|
| 284 |
+
``` cpp
|
| 285 |
+
static constexpr T quiet_NaN() noexcept;
|
| 286 |
+
```
|
| 287 |
+
|
| 288 |
+
Representation of a quiet “Not a Number”, if available.[^21]
|
| 289 |
+
|
| 290 |
+
Meaningful for all specializations for which `has_quiet_NaN != false`.
|
| 291 |
+
Required in specializations for which `is_iec559 != false`.
|
| 292 |
+
|
| 293 |
+
``` cpp
|
| 294 |
+
static constexpr T signaling_NaN() noexcept;
|
| 295 |
+
```
|
| 296 |
+
|
| 297 |
+
Representation of a signaling “Not a Number”, if available.[^22]
|
| 298 |
+
|
| 299 |
+
Meaningful for all specializations for which
|
| 300 |
+
`has_signaling_NaN != false`. Required in specializations for which
|
| 301 |
+
`is_iec559 != false`.
|
| 302 |
+
|
| 303 |
+
``` cpp
|
| 304 |
+
static constexpr T denorm_min() noexcept;
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
Minimum positive subnormal value.[^23]
|
| 308 |
+
|
| 309 |
+
Meaningful for all floating-point types.
|
| 310 |
+
|
| 311 |
+
In specializations for which `has_denorm == false`, returns the minimum
|
| 312 |
+
positive normalized value.
|
| 313 |
+
|
| 314 |
+
``` cpp
|
| 315 |
+
static constexpr bool is_iec559;
|
| 316 |
+
```
|
| 317 |
+
|
| 318 |
+
`true` if and only if the type adheres to ISO/IEC/IEEE 60559.[^24]
|
| 319 |
+
|
| 320 |
+
Meaningful for all floating-point types.
|
| 321 |
+
|
| 322 |
+
``` cpp
|
| 323 |
+
static constexpr bool is_bounded;
|
| 324 |
+
```
|
| 325 |
+
|
| 326 |
+
`true` if the set of values representable by the type is finite.[^25]
|
| 327 |
+
|
| 328 |
+
[*Note 1*: All fundamental types ([[basic.fundamental]]) are bounded.
|
| 329 |
+
This member would be `false` for arbitrary precision
|
| 330 |
+
types. — *end note*]
|
| 331 |
+
|
| 332 |
+
Meaningful for all specializations.
|
| 333 |
+
|
| 334 |
+
``` cpp
|
| 335 |
+
static constexpr bool is_modulo;
|
| 336 |
+
```
|
| 337 |
+
|
| 338 |
+
`true` if the type is modulo.[^26] A type is modulo if, for any
|
| 339 |
+
operation involving `+`, `-`, or `*` on values of that type whose result
|
| 340 |
+
would fall outside the range \[`min()`, `max()`\], the value returned
|
| 341 |
+
differs from the true value by an integer multiple of
|
| 342 |
+
`max() - min() + 1`.
|
| 343 |
+
|
| 344 |
+
[*Example 1*: `is_modulo` is `false` for signed integer
|
| 345 |
+
types ([[basic.fundamental]]) unless an implementation, as an extension
|
| 346 |
+
to this International Standard, defines signed integer overflow to
|
| 347 |
+
wrap. — *end example*]
|
| 348 |
+
|
| 349 |
+
Meaningful for all specializations.
|
| 350 |
+
|
| 351 |
+
``` cpp
|
| 352 |
+
static constexpr bool traps;
|
| 353 |
+
```
|
| 354 |
+
|
| 355 |
+
`true` if, at program startup, there exists a value of the type that
|
| 356 |
+
would cause an arithmetic operation using that value to trap.[^27]
|
| 357 |
+
|
| 358 |
+
Meaningful for all specializations.
|
| 359 |
+
|
| 360 |
+
``` cpp
|
| 361 |
+
static constexpr bool tinyness_before;
|
| 362 |
+
```
|
| 363 |
+
|
| 364 |
+
`true` if tinyness is detected before rounding.[^28]
|
| 365 |
+
|
| 366 |
+
Meaningful for all floating-point types.
|
| 367 |
+
|
| 368 |
+
``` cpp
|
| 369 |
+
static constexpr float_round_style round_style;
|
| 370 |
+
```
|
| 371 |
+
|
| 372 |
+
The rounding style for the type.[^29]
|
| 373 |
+
|
| 374 |
+
Meaningful for all floating-point types. Specializations for integer
|
| 375 |
+
types shall return `round_toward_zero`.
|
| 376 |
+
|
| 377 |
+
#### `numeric_limits` specializations <a id="numeric.special">[[numeric.special]]</a>
|
| 378 |
+
|
| 379 |
+
All members shall be provided for all specializations. However, many
|
| 380 |
+
values are only required to be meaningful under certain conditions (for
|
| 381 |
+
example, `epsilon()` is only meaningful if `is_integer` is `false`). Any
|
| 382 |
+
value that is not “meaningful” shall be set to 0 or `false`.
|
| 383 |
+
|
| 384 |
+
[*Example 1*:
|
| 385 |
+
|
| 386 |
+
``` cpp
|
| 387 |
+
namespace std {
|
| 388 |
+
template<> class numeric_limits<float> {
|
| 389 |
+
public:
|
| 390 |
+
static constexpr bool is_specialized = true;
|
| 391 |
+
|
| 392 |
+
static constexpr float min() noexcept { return 1.17549435E-38F; }
|
| 393 |
+
static constexpr float max() noexcept { return 3.40282347E+38F; }
|
| 394 |
+
static constexpr float lowest() noexcept { return -3.40282347E+38F; }
|
| 395 |
+
|
| 396 |
+
static constexpr int digits = 24;
|
| 397 |
+
static constexpr int digits10 = 6;
|
| 398 |
+
static constexpr int max_digits10 = 9;
|
| 399 |
+
|
| 400 |
+
static constexpr bool is_signed = true;
|
| 401 |
+
static constexpr bool is_integer = false;
|
| 402 |
+
static constexpr bool is_exact = false;
|
| 403 |
+
|
| 404 |
+
static constexpr int radix = 2;
|
| 405 |
+
static constexpr float epsilon() noexcept { return 1.19209290E-07F; }
|
| 406 |
+
static constexpr float round_error() noexcept { return 0.5F; }
|
| 407 |
+
|
| 408 |
+
static constexpr int min_exponent = -125;
|
| 409 |
+
static constexpr int min_exponent10 = - 37;
|
| 410 |
+
static constexpr int max_exponent = +128;
|
| 411 |
+
static constexpr int max_exponent10 = + 38;
|
| 412 |
+
|
| 413 |
+
static constexpr bool has_infinity = true;
|
| 414 |
+
static constexpr bool has_quiet_NaN = true;
|
| 415 |
+
static constexpr bool has_signaling_NaN = true;
|
| 416 |
+
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 417 |
+
static constexpr bool has_denorm_loss = false;
|
| 418 |
+
|
| 419 |
+
static constexpr float infinity() noexcept { return value; }
|
| 420 |
+
static constexpr float quiet_NaN() noexcept { return value; }
|
| 421 |
+
static constexpr float signaling_NaN() noexcept { return value; }
|
| 422 |
+
static constexpr float denorm_min() noexcept { return min(); }
|
| 423 |
+
|
| 424 |
+
static constexpr bool is_iec559 = true;
|
| 425 |
+
static constexpr bool is_bounded = true;
|
| 426 |
+
static constexpr bool is_modulo = false;
|
| 427 |
+
static constexpr bool traps = true;
|
| 428 |
+
static constexpr bool tinyness_before = true;
|
| 429 |
+
|
| 430 |
+
static constexpr float_round_style round_style = round_to_nearest;
|
| 431 |
+
};
|
| 432 |
+
}
|
| 433 |
+
```
|
| 434 |
+
|
| 435 |
+
— *end example*]
|
| 436 |
+
|
| 437 |
+
The specialization for `bool` shall be provided as follows:
|
| 438 |
+
|
| 439 |
+
``` cpp
|
| 440 |
+
namespace std {
|
| 441 |
+
template<> class numeric_limits<bool> {
|
| 442 |
+
public:
|
| 443 |
+
static constexpr bool is_specialized = true;
|
| 444 |
+
static constexpr bool min() noexcept { return false; }
|
| 445 |
+
static constexpr bool max() noexcept { return true; }
|
| 446 |
+
static constexpr bool lowest() noexcept { return false; }
|
| 447 |
+
|
| 448 |
+
static constexpr int digits = 1;
|
| 449 |
+
static constexpr int digits10 = 0;
|
| 450 |
+
static constexpr int max_digits10 = 0;
|
| 451 |
+
|
| 452 |
+
static constexpr bool is_signed = false;
|
| 453 |
+
static constexpr bool is_integer = true;
|
| 454 |
+
static constexpr bool is_exact = true;
|
| 455 |
+
static constexpr int radix = 2;
|
| 456 |
+
static constexpr bool epsilon() noexcept { return 0; }
|
| 457 |
+
static constexpr bool round_error() noexcept { return 0; }
|
| 458 |
+
|
| 459 |
+
static constexpr int min_exponent = 0;
|
| 460 |
+
static constexpr int min_exponent10 = 0;
|
| 461 |
+
static constexpr int max_exponent = 0;
|
| 462 |
+
static constexpr int max_exponent10 = 0;
|
| 463 |
+
|
| 464 |
+
static constexpr bool has_infinity = false;
|
| 465 |
+
static constexpr bool has_quiet_NaN = false;
|
| 466 |
+
static constexpr bool has_signaling_NaN = false;
|
| 467 |
+
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 468 |
+
static constexpr bool has_denorm_loss = false;
|
| 469 |
+
static constexpr bool infinity() noexcept { return 0; }
|
| 470 |
+
static constexpr bool quiet_NaN() noexcept { return 0; }
|
| 471 |
+
static constexpr bool signaling_NaN() noexcept { return 0; }
|
| 472 |
+
static constexpr bool denorm_min() noexcept { return 0; }
|
| 473 |
+
|
| 474 |
+
static constexpr bool is_iec559 = false;
|
| 475 |
+
static constexpr bool is_bounded = true;
|
| 476 |
+
static constexpr bool is_modulo = false;
|
| 477 |
+
|
| 478 |
+
static constexpr bool traps = false;
|
| 479 |
+
static constexpr bool tinyness_before = false;
|
| 480 |
+
static constexpr float_round_style round_style = round_toward_zero;
|
| 481 |
+
};
|
| 482 |
+
}
|
| 483 |
+
```
|
| 484 |
+
|