mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-23 00:48:11 -07:00
global: fixes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
f64,
|
||||
iter::Sum,
|
||||
ops::{Add, AddAssign, Div, Mul},
|
||||
};
|
||||
|
||||
@@ -77,6 +78,13 @@ impl Div<StoredF64> for StoredF64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Div<Dollars> for StoredF64 {
|
||||
type Output = Self;
|
||||
fn div(self, rhs: Dollars) -> Self::Output {
|
||||
Self::from(self.0 / *rhs)
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for StoredF64 {
|
||||
type Output = Self;
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
@@ -161,3 +169,9 @@ impl Printable for StoredF64 {
|
||||
&["f64"]
|
||||
}
|
||||
}
|
||||
|
||||
impl Sum for StoredF64 {
|
||||
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
|
||||
Self(iter.map(|v| v.0).sum::<f64>())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user