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. Co-Authored-By: Mateusz Mikuła <mati865@users.noreply.github.com>
This commit is contained in:
parent
cb6122db3f
commit
33bc9ef513
2 changed files with 8 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -109,10 +109,10 @@ impl f64 {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let x = 3.5_f64;
|
||||
/// let y = -3.5_f64;
|
||||
/// let abs_difference_x = (x.fract() - 0.5).abs();
|
||||
/// let abs_difference_y = (y.fract() - (-0.5)).abs();
|
||||
/// let x = 3.6_f64;
|
||||
/// let y = -3.6_f64;
|
||||
/// let abs_difference_x = (x.fract() - 0.6).abs();
|
||||
/// let abs_difference_y = (y.fract() - (-0.6)).abs();
|
||||
///
|
||||
/// assert!(abs_difference_x < 1e-10);
|
||||
/// assert!(abs_difference_y < 1e-10);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue