From e37179cfd72b80fa665b730222ce707205515459 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 9 Feb 2020 20:00:35 -0500 Subject: [PATCH] Properly handle precision --- src/value/number.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/value/number.rs b/src/value/number.rs index c456430..3921b62 100644 --- a/src/value/number.rs +++ b/src/value/number.rs @@ -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();