Properly handle precision

This commit is contained in:
ConnorSkees 2020-02-09 20:00:35 -05:00
parent 589ebce452
commit e37179cfd7

View File

@ -81,7 +81,7 @@ impl Display for Number {
let mut frac = self.val.fract();
if frac != BigRational::from_integer(BigInt::from(0)) {
f.write_char('.')?;
for _ in 0..PRECISION {
for _ in 0..(PRECISION-1) {
frac *= BigRational::from_integer(BigInt::from(10));
write!(f, "{}", frac.to_integer())?;
frac = frac.fract();