Skip to content

Commit a398e09

Browse files
committed
rustdoc: Add an example for round that is different from truncate
1 parent 534ddc6 commit a398e09

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Diff for: library/std/src/f32.rs

+2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ impl f32 {
7777
/// ```
7878
/// let f = 3.3_f32;
7979
/// let g = -3.3_f32;
80+
/// let h = -3.7_f32;
8081
///
8182
/// assert_eq!(f.round(), 3.0);
8283
/// assert_eq!(g.round(), -3.0);
84+
/// assert_eq!(h.round(), -4.0);
8385
/// ```
8486
#[rustc_allow_incoherent_impl]
8587
#[must_use = "method returns a new number and does not mutate the original value"]

Diff for: library/std/src/f64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ impl f64 {
7777
/// ```
7878
/// let f = 3.3_f64;
7979
/// let g = -3.3_f64;
80+
/// let h = -3.7_f64;
8081
///
8182
/// assert_eq!(f.round(), 3.0);
8283
/// assert_eq!(g.round(), -3.0);
84+
/// assert_eq!(h.round(), -4.0);
8385
/// ```
8486
#[rustc_allow_incoherent_impl]
8587
#[must_use = "method returns a new number and does not mutate the original value"]

0 commit comments

Comments
 (0)