Skip to content

Commit f3fc049

Browse files
committed
Fix for issue #107
1 parent c413b1b commit f3fc049

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/util/print_dec.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ pub unsafe fn write<W: io::Write>(wr: &mut W, positive: bool, mut n: u64, expone
7474
)
7575
);
7676
} else if exponent < 0 {
77-
let mut e = -exponent as u16;
77+
let mut e = match exponent.checked_neg() {
78+
Some(neg) => neg as u16,
79+
None => i16::max_value() as u16 + 1u16
80+
};
7881

7982
// Decimal number with a fraction that's fully printable
8083
if e < 18 {

0 commit comments

Comments
 (0)