diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-06-02 13:14:23 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-02 13:14:23 -0600 |
| commit | 6ff9108e120d728f7f5f2cf852280d411e47ce31 (patch) | |
| tree | 697a248c190343c24f955da4f73153fff9a1b5f4 /src/libcore/num | |
| parent | 77c8bd0b4e1805980ea811f543e65f870b74a59a (diff) | |
| parent | 12878a78a7528dbe5888fe70fd5a0861c820c86a (diff) | |
| download | rust-6ff9108e120d728f7f5f2cf852280d411e47ce31.tar.gz rust-6ff9108e120d728f7f5f2cf852280d411e47ce31.zip | |
Rollup merge of #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
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/f32.rs | 6 | ||||
| -rw-r--r-- | src/libcore/num/f64.rs | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index e5dbc65cd99..577c823f9a0 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -31,7 +31,11 @@ pub const MANTISSA_DIGITS: u32 = 24; #[stable(feature = "rust1", since = "1.0.0")] pub const DIGITS: u32 = 6; -/// Difference between `1.0` and the next largest representable number. +/// [Machine epsilon] value for `f32`. +/// +/// This is the difference between `1.0` and the next largest representable number. +/// +/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon #[stable(feature = "rust1", since = "1.0.0")] pub const EPSILON: f32 = 1.19209290e-07_f32; diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index eb769c4ad5a..b8e3dd6ed64 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -31,7 +31,11 @@ pub const MANTISSA_DIGITS: u32 = 53; #[stable(feature = "rust1", since = "1.0.0")] pub const DIGITS: u32 = 15; -/// Difference between `1.0` and the next largest representable number. +/// [Machine epsilon] value for `f64`. +/// +/// This is the difference between `1.0` and the next largest representable number. +/// +/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon #[stable(feature = "rust1", since = "1.0.0")] pub const EPSILON: f64 = 2.2204460492503131e-16_f64; |
