Skip to content

Commit

Permalink
Clarify rational behind current implementation of .mod_euc()
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Kössel committed Jun 26, 2018
1 parent af6f0f2 commit daeadc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libstd/f32.rs
Expand Up @@ -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
///
Expand Down
4 changes: 4 additions & 0 deletions src/libstd/f64.rs
Expand Up @@ -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
///
Expand Down

0 comments on commit daeadc6

Please sign in to comment.