Skip to content

Commit 06126df

Browse files
authored
Rollup merge of rust-lang#140150 - RalfJung:MAX_EXP, r=tgross35
fix MAX_EXP and MIN_EXP docs As pointed out in rust-lang#88734, the docs for these constants are wrong. r? ``@tgross35``
2 parents 9dcb367 + 157caee commit 06126df

File tree

4 files changed

+48
-24
lines changed

4 files changed

+48
-24
lines changed

library/core/src/num/f128.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,22 @@ impl f128 {
197197
#[unstable(feature = "f128", issue = "116909")]
198198
pub const MAX: f128 = 1.18973149535723176508575932662800702e+4932_f128;
199199

200-
/// One greater than the minimum possible normal power of 2 exponent.
200+
/// One greater than the minimum possible *normal* power of 2 exponent
201+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
201202
///
202-
/// If <i>x</i>&nbsp;=&nbsp;`MIN_EXP`, then normal numbers
203-
/// ≥&nbsp;0.5&nbsp;×&nbsp;2<sup><i>x</i></sup>.
203+
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
204+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
205+
/// In other words, all normal numbers representable by this type are
206+
/// greater than or equal to 0.5&nbsp;×&nbsp;2<sup><i>MIN_EXP</i></sup>.
204207
#[unstable(feature = "f128", issue = "116909")]
205208
pub const MIN_EXP: i32 = -16_381;
206-
/// Maximum possible power of 2 exponent.
209+
/// One greater than the maximum possible power of 2 exponent
210+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
207211
///
208-
/// If <i>x</i>&nbsp;=&nbsp;`MAX_EXP`, then normal numbers
209-
/// &lt;&nbsp;1&nbsp;×&nbsp;2<sup><i>x</i></sup>.
212+
/// This corresponds to the exact maximum possible power of 2 exponent
213+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
214+
/// In other words, all numbers representable by this type are
215+
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
210216
#[unstable(feature = "f128", issue = "116909")]
211217
pub const MAX_EXP: i32 = 16_384;
212218

library/core/src/num/f16.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,22 @@ impl f16 {
192192
#[unstable(feature = "f16", issue = "116909")]
193193
pub const MAX: f16 = 6.5504e+4_f16;
194194

195-
/// One greater than the minimum possible normal power of 2 exponent.
195+
/// One greater than the minimum possible *normal* power of 2 exponent
196+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
196197
///
197-
/// If <i>x</i>&nbsp;=&nbsp;`MIN_EXP`, then normal numbers
198-
/// ≥&nbsp;0.5&nbsp;×&nbsp;2<sup><i>x</i></sup>.
198+
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
199+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
200+
/// In other words, all normal numbers representable by this type are
201+
/// greater than or equal to 0.5&nbsp;×&nbsp;2<sup><i>MIN_EXP</i></sup>.
199202
#[unstable(feature = "f16", issue = "116909")]
200203
pub const MIN_EXP: i32 = -13;
201-
/// Maximum possible power of 2 exponent.
204+
/// One greater than the maximum possible power of 2 exponent
205+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
202206
///
203-
/// If <i>x</i>&nbsp;=&nbsp;`MAX_EXP`, then normal numbers
204-
/// &lt;&nbsp;1&nbsp;×&nbsp;2<sup><i>x</i></sup>.
207+
/// This corresponds to the exact maximum possible power of 2 exponent
208+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
209+
/// In other words, all numbers representable by this type are
210+
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
205211
#[unstable(feature = "f16", issue = "116909")]
206212
pub const MAX_EXP: i32 = 16;
207213

library/core/src/num/f32.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,22 @@ impl f32 {
443443
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
444444
pub const MAX: f32 = 3.40282347e+38_f32;
445445

446-
/// One greater than the minimum possible normal power of 2 exponent.
446+
/// One greater than the minimum possible *normal* power of 2 exponent
447+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
447448
///
448-
/// If <i>x</i>&nbsp;=&nbsp;`MIN_EXP`, then normal numbers
449-
/// ≥&nbsp;0.5&nbsp;×&nbsp;2<sup><i>x</i></sup>.
449+
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
450+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
451+
/// In other words, all normal numbers representable by this type are
452+
/// greater than or equal to 0.5&nbsp;×&nbsp;2<sup><i>MIN_EXP</i></sup>.
450453
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
451454
pub const MIN_EXP: i32 = -125;
452-
/// Maximum possible power of 2 exponent.
455+
/// One greater than the maximum possible power of 2 exponent
456+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
453457
///
454-
/// If <i>x</i>&nbsp;=&nbsp;`MAX_EXP`, then normal numbers
455-
/// &lt;&nbsp;1&nbsp;×&nbsp;2<sup><i>x</i></sup>.
458+
/// This corresponds to the exact maximum possible power of 2 exponent
459+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
460+
/// In other words, all numbers representable by this type are
461+
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
456462
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
457463
pub const MAX_EXP: i32 = 128;
458464

library/core/src/num/f64.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -442,16 +442,22 @@ impl f64 {
442442
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
443443
pub const MAX: f64 = 1.7976931348623157e+308_f64;
444444

445-
/// One greater than the minimum possible normal power of 2 exponent.
445+
/// One greater than the minimum possible *normal* power of 2 exponent
446+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
446447
///
447-
/// If <i>x</i>&nbsp;=&nbsp;`MIN_EXP`, then normal numbers
448-
/// ≥&nbsp;0.5&nbsp;×&nbsp;2<sup><i>x</i></sup>.
448+
/// This corresponds to the exact minimum possible *normal* power of 2 exponent
449+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
450+
/// In other words, all normal numbers representable by this type are
451+
/// greater than or equal to 0.5&nbsp;×&nbsp;2<sup><i>MIN_EXP</i></sup>.
449452
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
450453
pub const MIN_EXP: i32 = -1021;
451-
/// Maximum possible power of 2 exponent.
454+
/// One greater than the maximum possible power of 2 exponent
455+
/// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition).
452456
///
453-
/// If <i>x</i>&nbsp;=&nbsp;`MAX_EXP`, then normal numbers
454-
/// &lt;&nbsp;1&nbsp;×&nbsp;2<sup><i>x</i></sup>.
457+
/// This corresponds to the exact maximum possible power of 2 exponent
458+
/// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition).
459+
/// In other words, all numbers representable by this type are
460+
/// strictly less than 2<sup><i>MAX_EXP</i></sup>.
455461
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
456462
pub const MAX_EXP: i32 = 1024;
457463

0 commit comments

Comments
 (0)