mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 04:55:22 +03:00
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:
+4
-4
@@ -131,10 +131,10 @@ pub fn trunc(self) -> 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);
|
||||
|
||||
+4
-4
@@ -109,10 +109,10 @@ pub fn trunc(self) -> 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);
|
||||
|
||||
Reference in New Issue
Block a user