Properly handle precision
This commit is contained in:
parent
589ebce452
commit
e37179cfd7
@ -81,7 +81,7 @@ impl Display for Number {
|
|||||||
let mut frac = self.val.fract();
|
let mut frac = self.val.fract();
|
||||||
if frac != BigRational::from_integer(BigInt::from(0)) {
|
if frac != BigRational::from_integer(BigInt::from(0)) {
|
||||||
f.write_char('.')?;
|
f.write_char('.')?;
|
||||||
for _ in 0..PRECISION {
|
for _ in 0..(PRECISION-1) {
|
||||||
frac *= BigRational::from_integer(BigInt::from(10));
|
frac *= BigRational::from_integer(BigInt::from(10));
|
||||||
write!(f, "{}", frac.to_integer())?;
|
write!(f, "{}", frac.to_integer())?;
|
||||||
frac = frac.fract();
|
frac = frac.fract();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user