rustdoc: Add an example for round that is different from truncate
This commit is contained in:
parent
534ddc6166
commit
a398e09e42
@ -77,9 +77,11 @@ impl f32 {
|
||||
/// ```
|
||||
/// let f = 3.3_f32;
|
||||
/// let g = -3.3_f32;
|
||||
/// let h = -3.7_f32;
|
||||
///
|
||||
/// assert_eq!(f.round(), 3.0);
|
||||
/// assert_eq!(g.round(), -3.0);
|
||||
/// assert_eq!(h.round(), -4.0);
|
||||
/// ```
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
|
@ -77,9 +77,11 @@ impl f64 {
|
||||
/// ```
|
||||
/// let f = 3.3_f64;
|
||||
/// let g = -3.3_f64;
|
||||
/// let h = -3.7_f64;
|
||||
///
|
||||
/// assert_eq!(f.round(), 3.0);
|
||||
/// assert_eq!(g.round(), -3.0);
|
||||
/// assert_eq!(h.round(), -4.0);
|
||||
/// ```
|
||||
#[rustc_allow_incoherent_impl]
|
||||
#[must_use = "method returns a new number and does not mutate the original value"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user