mirror of
https://github.com/rm-dr/daisy
synced 2025-07-01 06:33:34 -07:00
Improved unit printing
This commit is contained in:
@ -24,6 +24,7 @@ pub trait ScalarBase:
|
||||
// Utility
|
||||
fn fract(&self) -> Option<Self>;
|
||||
fn is_zero(&self) -> bool;
|
||||
fn is_one(&self) -> bool;
|
||||
fn is_negative(&self) -> bool;
|
||||
fn is_positive(&self) -> bool;
|
||||
|
||||
@ -163,6 +164,13 @@ impl Scalar {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_one(&self) -> bool {
|
||||
match self {
|
||||
Scalar::Rational{v} => v.is_one(),
|
||||
Scalar::Float{v} => v.is_one(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_negative(&self) -> bool {
|
||||
match self {
|
||||
Scalar::Rational{v} => v.is_negative(),
|
||||
|
Reference in New Issue
Block a user