40 -> 39, as ceil(log10(2^128)) == 39
just as ceil(log10(2^64)) == 20
This commit is contained in:
parent
3b34f90bc1
commit
c79aba71d5
2 changed files with 3 additions and 1 deletions
|
@ -211,7 +211,7 @@ macro_rules! impl_Display {
|
||||||
// convert the negative num to positive by summing 1 to it's 2 complement
|
// convert the negative num to positive by summing 1 to it's 2 complement
|
||||||
(!self.$conv_fn()).wrapping_add(1)
|
(!self.$conv_fn()).wrapping_add(1)
|
||||||
};
|
};
|
||||||
let mut buf: [u8; 40] = unsafe { mem::uninitialized() };
|
let mut buf: [u8; 39] = unsafe { mem::uninitialized() };
|
||||||
let mut curr = buf.len() as isize;
|
let mut curr = buf.len() as isize;
|
||||||
let buf_ptr = buf.as_mut_ptr();
|
let buf_ptr = buf.as_mut_ptr();
|
||||||
let lut_ptr = DEC_DIGITS_LUT.as_ptr();
|
let lut_ptr = DEC_DIGITS_LUT.as_ptr();
|
||||||
|
|
|
@ -59,6 +59,8 @@ fn main() {
|
||||||
assert_eq!("20000000000000000000000", format!("{:o}", j));
|
assert_eq!("20000000000000000000000", format!("{:o}", j));
|
||||||
assert_eq!("10000000000000000000000000000000000000000000000000000000000000000000",
|
assert_eq!("10000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
format!("{:b}", j));
|
format!("{:b}", j));
|
||||||
|
assert_eq!("340282366920938463463374607431768211455",
|
||||||
|
format!("{}", u128::max_value()));
|
||||||
assert_eq!("147573952589676412928", format!("{:?}", j));
|
assert_eq!("147573952589676412928", format!("{:?}", j));
|
||||||
// common traits
|
// common traits
|
||||||
x.clone();
|
x.clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue