decimal icon indicating copy to clipboard operation
decimal copied to clipboard

Incorrect formatting

Open mcseemk opened this issue 7 years ago • 2 comments

It looks like d128 incorrectly interprets precision as width when printing values, for example:

let test: d128 = d128::from_str("123.12345678").unwrap(); print!("Should print 123.12345678, actual output: {:.8}", test);

This code prints 123.1234 instead of 123.12345678

mcseemk avatar Jan 29 '18 06:01 mcseemk

Thanks for the report!

Care to provide a patch? Perhaps instead of fmt.pad we should use fmt.pad_integral to ignore precision? Would that work on all cases?

alkis avatar Jan 29 '18 20:01 alkis

To be honest, I'm new to Rust, so I have no idea.

mcseemk avatar Jan 29 '18 21:01 mcseemk