Skip to content

Commit 6ff9108

Browse files
Rollup merge of rust-lang#50919 - frewsxcv:frewsxcv-epsilon, r=steveklabnik
Provide more context for what the {f32,f64}::EPSILON values represent. Introduce the 'machine epsilon' term because if one googles 'epsilon', they might stumble upon https://en.wikipedia.org/wiki/Epsilon_numbers_(mathematics) instead of https://en.wikipedia.org/wiki/Machine_epsilon
2 parents 77c8bd0 + 12878a7 commit 6ff9108

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/libcore/num/f32.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ pub const MANTISSA_DIGITS: u32 = 24;
3131
#[stable(feature = "rust1", since = "1.0.0")]
3232
pub const DIGITS: u32 = 6;
3333

34-
/// Difference between `1.0` and the next largest representable number.
34+
/// [Machine epsilon] value for `f32`.
35+
///
36+
/// This is the difference between `1.0` and the next largest representable number.
37+
///
38+
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
3539
#[stable(feature = "rust1", since = "1.0.0")]
3640
pub const EPSILON: f32 = 1.19209290e-07_f32;
3741

src/libcore/num/f64.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ pub const MANTISSA_DIGITS: u32 = 53;
3131
#[stable(feature = "rust1", since = "1.0.0")]
3232
pub const DIGITS: u32 = 15;
3333

34-
/// Difference between `1.0` and the next largest representable number.
34+
/// [Machine epsilon] value for `f64`.
35+
///
36+
/// This is the difference between `1.0` and the next largest representable number.
37+
///
38+
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
3539
#[stable(feature = "rust1", since = "1.0.0")]
3640
pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
3741

0 commit comments

Comments
 (0)