diff options
| author | Ralf Jung <post@ralfj.de> | 2025-04-22 09:32:00 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-04-23 14:04:18 +0200 |
| commit | 157caeed3e8b73bba883113b34b9f4d9d0779cbf (patch) | |
| tree | 21aa6b0cb4a013ea054e6da72734eaf0eab48575 | |
| parent | fae7785b60ea7fe1ad293352c057a5b7be73d245 (diff) | |
| download | rust-157caeed3e8b73bba883113b34b9f4d9d0779cbf.tar.gz rust-157caeed3e8b73bba883113b34b9f4d9d0779cbf.zip | |
fix f*::MAX_EXP and MIN_EXP docs
| -rw-r--r-- | library/core/src/num/f128.rs | 18 | ||||
| -rw-r--r-- | library/core/src/num/f16.rs | 18 | ||||
| -rw-r--r-- | library/core/src/num/f32.rs | 18 | ||||
| -rw-r--r-- | library/core/src/num/f64.rs | 18 |
4 files changed, 48 insertions, 24 deletions
diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index d3d1eebc227..c7c28f2af2a 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -194,16 +194,22 @@ impl f128 { #[unstable(feature = "f128", issue = "116909")] pub const MAX: f128 = 1.18973149535723176508575932662800702e+4932_f128; - /// One greater than the minimum possible normal power of 2 exponent. + /// One greater than the minimum possible *normal* power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MIN_EXP`, then normal numbers - /// ≥ 0.5 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact minimum possible *normal* power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all normal numbers representable by this type are + /// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>. #[unstable(feature = "f128", issue = "116909")] pub const MIN_EXP: i32 = -16_381; - /// Maximum possible power of 2 exponent. + /// One greater than the maximum possible power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MAX_EXP`, then normal numbers - /// < 1 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact maximum possible power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all numbers representable by this type are + /// strictly less than 2<sup><i>MAX_EXP</i></sup>. #[unstable(feature = "f128", issue = "116909")] pub const MAX_EXP: i32 = 16_384; diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index dceb30177e6..8615b8d82e6 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -189,16 +189,22 @@ impl f16 { #[unstable(feature = "f16", issue = "116909")] pub const MAX: f16 = 6.5504e+4_f16; - /// One greater than the minimum possible normal power of 2 exponent. + /// One greater than the minimum possible *normal* power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MIN_EXP`, then normal numbers - /// ≥ 0.5 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact minimum possible *normal* power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all normal numbers representable by this type are + /// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>. #[unstable(feature = "f16", issue = "116909")] pub const MIN_EXP: i32 = -13; - /// Maximum possible power of 2 exponent. + /// One greater than the maximum possible power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MAX_EXP`, then normal numbers - /// < 1 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact maximum possible power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all numbers representable by this type are + /// strictly less than 2<sup><i>MAX_EXP</i></sup>. #[unstable(feature = "f16", issue = "116909")] pub const MAX_EXP: i32 = 16; diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index c97dbfb63ae..60e37c10fd2 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -440,16 +440,22 @@ impl f32 { #[stable(feature = "assoc_int_consts", since = "1.43.0")] pub const MAX: f32 = 3.40282347e+38_f32; - /// One greater than the minimum possible normal power of 2 exponent. + /// One greater than the minimum possible *normal* power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MIN_EXP`, then normal numbers - /// ≥ 0.5 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact minimum possible *normal* power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all normal numbers representable by this type are + /// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>. #[stable(feature = "assoc_int_consts", since = "1.43.0")] pub const MIN_EXP: i32 = -125; - /// Maximum possible power of 2 exponent. + /// One greater than the maximum possible power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MAX_EXP`, then normal numbers - /// < 1 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact maximum possible power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all numbers representable by this type are + /// strictly less than 2<sup><i>MAX_EXP</i></sup>. #[stable(feature = "assoc_int_consts", since = "1.43.0")] pub const MAX_EXP: i32 = 128; diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index 91affdb3794..48c7263447a 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -439,16 +439,22 @@ impl f64 { #[stable(feature = "assoc_int_consts", since = "1.43.0")] pub const MAX: f64 = 1.7976931348623157e+308_f64; - /// One greater than the minimum possible normal power of 2 exponent. + /// One greater than the minimum possible *normal* power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MIN_EXP`, then normal numbers - /// ≥ 0.5 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact minimum possible *normal* power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all normal numbers representable by this type are + /// greater than or equal to 0.5 × 2<sup><i>MIN_EXP</i></sup>. #[stable(feature = "assoc_int_consts", since = "1.43.0")] pub const MIN_EXP: i32 = -1021; - /// Maximum possible power of 2 exponent. + /// One greater than the maximum possible power of 2 exponent + /// for a significand bounded by 1 ≤ x < 2 (i.e. the IEEE definition). /// - /// If <i>x</i> = `MAX_EXP`, then normal numbers - /// < 1 × 2<sup><i>x</i></sup>. + /// This corresponds to the exact maximum possible power of 2 exponent + /// for a significand bounded by 0.5 ≤ x < 1 (i.e. the C definition). + /// In other words, all numbers representable by this type are + /// strictly less than 2<sup><i>MAX_EXP</i></sup>. #[stable(feature = "assoc_int_consts", since = "1.43.0")] pub const MAX_EXP: i32 = 1024; |
