Skip to content

Commit 919da48

Browse files
authored
Rollup merge of rust-lang#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`)
2 parents 1c73bca + d43615f commit 919da48

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/libstd/f32.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ impl f32 {
131131
/// ```
132132
/// use std::f32;
133133
///
134-
/// let x = 3.5_f32;
135-
/// let y = -3.5_f32;
136-
/// let abs_difference_x = (x.fract() - 0.5).abs();
137-
/// let abs_difference_y = (y.fract() - (-0.5)).abs();
134+
/// let x = 3.6_f32;
135+
/// let y = -3.6_f32;
136+
/// let abs_difference_x = (x.fract() - 0.6).abs();
137+
/// let abs_difference_y = (y.fract() - (-0.6)).abs();
138138
///
139139
/// assert!(abs_difference_x <= f32::EPSILON);
140140
/// assert!(abs_difference_y <= f32::EPSILON);

src/libstd/f64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ impl f64 {
109109
/// # Examples
110110
///
111111
/// ```
112-
/// let x = 3.5_f64;
113-
/// let y = -3.5_f64;
112+
/// let x = 3.6_f64;
113+
/// let y = -3.6_f64;
114114
/// let abs_difference_x = (x.fract() - 0.5).abs();
115-
/// let abs_difference_y = (y.fract() - (-0.5)).abs();
115+
/// let abs_difference_y = (y.fract() - (-0.6)).abs();
116116
///
117117
/// assert!(abs_difference_x < 1e-10);
118118
/// assert!(abs_difference_y < 1e-10);

0 commit comments

Comments
 (0)