diff options
| author | Fabian Kössel <fkjogu@users.noreply.github.com> | 2018-05-28 12:40:16 +0200 |
|---|---|---|
| committer | Fabian Kössel <fkjogu@users.noreply.github.com> | 2018-06-26 13:09:56 +0200 |
| commit | daeadc6c2ef75133303b0ad66008ef5fb656a228 (patch) | |
| tree | 306a80e19463a588eecd39cbc1b32f7ffdec2804 /src/libstd | |
| parent | af6f0f2e1011b359cca0d16d9430e293d21ff707 (diff) | |
| download | rust-daeadc6c2ef75133303b0ad66008ef5fb656a228.tar.gz rust-daeadc6c2ef75133303b0ad66008ef5fb656a228.zip | |
Clarify rational behind current implementation of `.mod_euc()`
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/f32.rs | 4 | ||||
| -rw-r--r-- | src/libstd/f64.rs | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 24204670229..8e8340b3ed9 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -258,6 +258,10 @@ impl f32 { /// most cases. However, due to a floating point round-off error it can /// result in `r == rhs.abs()`, violating the mathematical definition, if /// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`. + /// This result is not an element of the function's codomain, but it is the + /// closest floating point number in the real numbers and thus fulfills the + /// property `self == self.div_euc(rhs) * rhs + self.mod_euc(rhs)` + /// approximatively. /// /// # Examples /// diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index bd7ef2eb1a4..6880294afca 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -234,6 +234,10 @@ impl f64 { /// most cases. However, due to a floating point round-off error it can /// result in `r == rhs.abs()`, violating the mathematical definition, if /// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`. + /// This result is not an element of the function's codomain, but it is the + /// closest floating point number in the real numbers and thus fulfills the + /// property `self == self.div_euc(rhs) * rhs + self.mod_euc(rhs)` + /// approximatively. /// /// # Examples /// |
