dtolnay/itoa

128 max lengths

Closed this issue · 2 comments

Hi was just passing through and might have spotted something slightly amiss.

I agree that i64 and u64 has different max lengths (19, 20) but I don't believe this is the case for 128:

itoa/src/lib.rs

Line 354 in ac8183c

const U128_MAX_LEN: usize = 39;

Shouldn't they both be 39?

(also if we're there we should probably make that other constant only available with the feature)

(If you agree I'll raise a PR to adjust.)

println!("{}", i128::MIN.to_string().len());

Ah I'm missing the minus sign. Makes sense now. Sorry!