changes
This commit is contained in:
@@ -36,6 +36,9 @@ impl FiNum {
|
||||
pub fn recip(&self) -> Self {
|
||||
FiNum((0x8000000000000000u64/self.0)<<1)
|
||||
}
|
||||
pub fn fmt_pct2(&self) -> String {
|
||||
format!("{:>5.2}%", (100.0*(self.0 as f64))/((1u64<<32) as f64))
|
||||
}
|
||||
pub fn fmt_recip(&self) -> String {
|
||||
if *self<FiNum::one() { format!("1/{}",self.recip()) }
|
||||
else { format!("{}",self) }
|
||||
@@ -120,6 +123,7 @@ impl Div for FiNum {
|
||||
|
||||
impl std::fmt::Display for FiNum {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
// write!(f, "{:08X}.{:08X}", self.0>>32,self.0&0xFFFFFFFF)
|
||||
write!(f, "{:.8}", (self.0 as f64)/((1u64<<32) as f64))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user