changes
This commit is contained in:
@@ -21,6 +21,9 @@ impl FiNum {
|
||||
pub fn zero() -> Self {
|
||||
FiNum(0u64)
|
||||
}
|
||||
pub fn one() -> Self {
|
||||
FiNum(1u64<<32)
|
||||
}
|
||||
pub fn is_zero(self) -> bool {
|
||||
self.0==0
|
||||
}
|
||||
@@ -30,6 +33,10 @@ impl FiNum {
|
||||
pub fn recip(&self) -> Self {
|
||||
FiNum((0x8000000000000000u64/self.0)<<1)
|
||||
}
|
||||
pub fn fmt_recip(&self) -> String {
|
||||
if *self<FiNum::one() { format!("1/{}",self.recip()) }
|
||||
else { format!("{}",self) }
|
||||
}
|
||||
pub fn serialize(&self) -> String {
|
||||
format!("{:X}",self.0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user