Skip to content

Commit 552758e

Browse files
committed
Update comment on duration rounding behavior
1 parent 74156a8 commit 552758e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/time.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,8 @@ impl fmt::Debug for Duration {
13171317
// need to perform rounding to match the semantics of printing
13181318
// normal floating point numbers. However, we only need to do work
13191319
// when rounding up. This happens if the first digit of the
1320-
// remaining ones is >= 5.
1320+
// remaining ones is > 5. When the first digit is exactly 5, rounding
1321+
// follows IEEE-754 round-ties-to-even semantics.
13211322
let integer_part = if fractional_part > 0 && fractional_part == divisor * 5 {
13221323
let last_digit_is_odd = if pos > 0 {
13231324
(buf[pos - 1] - b'0') % 2 == 1

0 commit comments

Comments
 (0)