mirror of
https://github.com/rm-dr/daisy
synced 2025-10-22 18:14:32 -07:00
Cleanup
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use rug::Rational;
|
||||
use rug::Integer;
|
||||
use rug::ops::Pow;
|
||||
|
||||
use std::ops::{
|
||||
Add, Sub, Mul, Div,
|
||||
@ -109,6 +110,10 @@ impl ScalarBase for RationalBase {
|
||||
Some(RationalBase{val: self.val.clone().fract_floor(Integer::new()).0})
|
||||
}
|
||||
|
||||
fn is_int(&self) -> bool {
|
||||
self.fract() == RationalBase::from_f64(0f64)
|
||||
}
|
||||
|
||||
fn is_zero(&self) -> bool {self.val == Rational::from((0,1))}
|
||||
fn is_one(&self) -> bool {self.val == Rational::from((1,1))}
|
||||
fn is_negative(&self) -> bool { self.val.clone().signum() == -1 }
|
||||
|
Reference in New Issue
Block a user