Display decimal for number uses with_capacity
This commit is contained in:
parent
5edd0d4f35
commit
1749f65fd9
@ -191,9 +191,8 @@ impl fmt::Debug for Number {
|
||||
impl Display for Number {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut whole = self.val.to_integer().abs();
|
||||
let mut dec = String::new();
|
||||
|
||||
let mut frac = self.val.fract();
|
||||
let mut dec = String::with_capacity(if frac.is_zero() { 0 } else { PRECISION + 1 });
|
||||
if frac != BigRational::from_integer(BigInt::from(0)) {
|
||||
dec.write_char('.')?;
|
||||
for _ in 0..(PRECISION - 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user