summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-01-16 11:58:04 +0530
committerGitHub <noreply@github.com>2020-01-16 11:58:04 +0530
commit69eee569d6ad5de5519bed8081e7115f7d7c255b (patch)
tree47de75cdc608050b1a0701fd357b0b632b601985
parentRollup merge of #68096 - varkor:diagnostic-cleanup, r=Centril (diff)
parentUse 3.6 instead of 3.5 in float fract() documentation (diff)
downloadrust-69eee569d6ad5de5519bed8081e7115f7d7c255b.tar.gz
rust-69eee569d6ad5de5519bed8081e7115f7d7c255b.tar.bz2
rust-69eee569d6ad5de5519bed8081e7115f7d7c255b.tar.xz
Rollup merge of #68223 - SOF3:float-fract-doc, r=varkor
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`)
-rw-r--r--src/libstd/f32.rs8
-rw-r--r--src/libstd/f64.rs8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs
index 267d701..209eea4 100644
--- a/src/libstd/f32.rs
+++ b/src/libstd/f32.rs
@@ -131,10 +131,10 @@ impl f32 {
131 /// ``` 131 /// ```
132 /// use std::f32; 132 /// use std::f32;
133 /// 133 ///
134 /// let x = 3.5_f32; 134 /// let x = 3.6_f32;
135 /// let y = -3.5_f32; 135 /// let y = -3.6_f32;
136 /// let abs_difference_x = (x.fract() - 0.5).abs(); 136 /// let abs_difference_x = (x.fract() - 0.6).abs();
137 /// let abs_difference_y = (y.fract() - (-0.5)).abs(); 137 /// let abs_difference_y = (y.fract() - (-0.6)).abs();
138 /// 138 ///
139 /// assert!(abs_difference_x <= f32::EPSILON); 139 /// assert!(abs_difference_x <= f32::EPSILON);
140 /// assert!(abs_difference_y <= f32::EPSILON); 140 /// assert!(abs_difference_y <= f32::EPSILON);
diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs
index 61ce7b2..15fbb91 100644
--- a/src/libstd/f64.rs
+++ b/src/libstd/f64.rs
@@ -109,10 +109,10 @@ impl f64 {
109 /// # Examples 109 /// # Examples
110 /// 110 ///
111 /// ``` 111 /// ```
112 /// let x = 3.5_f64; 112 /// let x = 3.6_f64;
113 /// let y = -3.5_f64; 113 /// let y = -3.6_f64;
114 /// let abs_difference_x = (x.fract() - 0.5).abs(); 114 /// let abs_difference_x = (x.fract() - 0.6).abs();
115 /// let abs_difference_y = (y.fract() - (-0.5)).abs(); 115 /// let abs_difference_y = (y.fract() - (-0.6)).abs();
116 /// 116 ///
117 /// assert!(abs_difference_x < 1e-10); 117 /// assert!(abs_difference_x < 1e-10);
118 /// assert!(abs_difference_y < 1e-10); 118 /// assert!(abs_difference_y < 1e-10);