Data update

This commit is contained in:
Ingy döt Net 2023-09-16 17:28:03 -07:00
parent 5af6d93694
commit 796d366b97
455 changed files with 7413 additions and 1900 deletions

View file

@ -49,7 +49,7 @@ impl Mul<u64> for Currency {
impl fmt::Display for Currency {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let cents = (&self.amount * BigInt::from(100)).to_integer();
write!(f, "${}.{}", &cents / 100, &cents % 100)
write!(f, "${}.{:0>2}", &cents / 100, &cents % 100)
}
}
@ -57,7 +57,7 @@ impl Currency {
fn new(num: f64) -> Self {
Self {
amount: BigRational::new(((num * 100.0) as i64).into(), 100.into())
amount: BigRational::new(((num * 100.0).round() as i64).into(), 100.into())
}
}