Skip to content

Commit

Permalink
Use 3.6 instead of 3.5 in float fract() documentation
Browse files Browse the repository at this point in the history
It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers.
  • Loading branch information
SOF3 committed Jan 14, 2020
1 parent cb6122d commit d43615f
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 d43615f

Please sign in to comment.