@@ -638,8 +638,10 @@ impl Duration {
638
638
/// use std::time::Duration;
639
639
///
640
640
/// let dur = Duration::new(2, 700_000_000);
641
- /// assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_000));
642
- /// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0));
641
+ /// // note that due to rounding errors result is slightly different
642
+ /// // from 8.478
643
+ /// assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_640));
644
+ /// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 64_000_000));
643
645
/// ```
644
646
#[ unstable( feature = "duration_float" , issue = "54361" ) ]
645
647
#[ inline]
@@ -679,7 +681,9 @@ impl Duration {
679
681
/// use std::time::Duration;
680
682
///
681
683
/// let dur = Duration::new(2, 700_000_000);
682
- /// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_611));
684
+ /// // note that due to rounding errors result is slightly
685
+ /// // different from 0.859_872_611
686
+ /// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_576));
683
687
/// // note that truncation is used, not rounding
684
688
/// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_598));
685
689
/// ```
@@ -698,7 +702,7 @@ impl Duration {
698
702
///
699
703
/// let dur1 = Duration::new(2, 700_000_000);
700
704
/// let dur2 = Duration::new(5, 400_000_000);
701
- /// assert_eq!(dur1.div_duration (dur2), 0.5);
705
+ /// assert_eq!(dur1.div_duration_f64 (dur2), 0.5);
702
706
/// ```
703
707
#[ unstable( feature = "duration_float" , issue = "54361" ) ]
704
708
#[ inline]
@@ -715,7 +719,7 @@ impl Duration {
715
719
///
716
720
/// let dur1 = Duration::new(2, 700_000_000);
717
721
/// let dur2 = Duration::new(5, 400_000_000);
718
- /// assert_eq!(dur1.div_duration (dur2), 0.5);
722
+ /// assert_eq!(dur1.div_duration_f32 (dur2), 0.5);
719
723
/// ```
720
724
#[ unstable( feature = "duration_float" , issue = "54361" ) ]
721
725
#[ inline]
0 commit comments