From 33bc9ef513d632825ea600cfb4bb6d89f4a09269 Mon Sep 17 00:00:00 2001 From: SOFe Date: Wed, 15 Jan 2020 02:07:39 +0800 Subject: [PATCH] Use 3.6 instead of 3.5 in float fract() documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. Co-Authored-By: Mateusz MikuĊ‚a --- src/libstd/f32.rs | 8 ++++---- src/libstd/f64.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 267d7013b1e42..209eea4a5ff73 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -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); diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 61ce7b29e26fc..15fbb911d043a 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -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);