Skip to content

Commit e64e93e

Browse files
committed
40 -> 39, as ceil(log10(2^128)) == 39
just as ceil(log10(2^64)) == 20
1 parent 28cd473 commit e64e93e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/libcore/fmt/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ macro_rules! impl_Display {
211211
// convert the negative num to positive by summing 1 to it's 2 complement
212212
(!self.$conv_fn()).wrapping_add(1)
213213
};
214-
let mut buf: [u8; 40] = unsafe { mem::uninitialized() };
214+
let mut buf: [u8; 39] = unsafe { mem::uninitialized() };
215215
let mut curr = buf.len() as isize;
216216
let buf_ptr = buf.as_mut_ptr();
217217
let lut_ptr = DEC_DIGITS_LUT.as_ptr();

src/test/run-pass/u128.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ fn main() {
5959
assert_eq!("20000000000000000000000", format!("{:o}", j));
6060
assert_eq!("10000000000000000000000000000000000000000000000000000000000000000000",
6161
format!("{:b}", j));
62+
assert_eq!("340282366920938463463374607431768211455",
63+
format!("{}", u128::max_value()));
6264
assert_eq!("147573952589676412928", format!("{:?}", j));
6365
// common traits
6466
x.clone();

0 commit comments

Comments
 (0)