Skip to content

Commit

Permalink
Rollup merge of rust-lang#68223 - SOF3:float-fract-doc, r=varkor
Browse files Browse the repository at this point in the history
Use 3.6 instead of 3.5 in float fract() documentation

It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. This change clarifies this possible question (so that it is `.6` not `.4`)
  • Loading branch information
Dylan-DPC authored Jan 15, 2020
2 parents 1c73bca + d43615f commit 919da48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/libstd/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ impl f32 {
/// ```
/// use std::f32;
///
/// let x = 3.5_f32;
/// let y = -3.5_f32;
/// let abs_difference_x = (x.fract() - 0.5).abs();
/// let abs_difference_y = (y.fract() - (-0.5)).abs();
/// let x = 3.6_f32;
/// let y = -3.6_f32;
/// let abs_difference_x = (x.fract() - 0.6).abs();
/// let abs_difference_y = (y.fract() - (-0.6)).abs();
///
/// assert!(abs_difference_x <= f32::EPSILON);
/// assert!(abs_difference_y <= f32::EPSILON);
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ impl f64 {
/// # Examples
///
/// ```
/// let x = 3.5_f64;
/// let y = -3.5_f64;
/// let x = 3.6_f64;
/// let y = -3.6_f64;
/// let abs_difference_x = (x.fract() - 0.5).abs();
/// let abs_difference_y = (y.fract() - (-0.5)).abs();
/// let abs_difference_y = (y.fract() - (-0.6)).abs();
///
/// assert!(abs_difference_x < 1e-10);
/// assert!(abs_difference_y < 1e-10);
Expand Down

0 comments on commit 919da48

Please sign in to comment.