Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
|
|
@ -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, "${}.{}", ¢s / 100, ¢s % 100)
|
||||
write!(f, "${}.{:0>2}", ¢s / 100, ¢s % 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())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue