core: add abs to num.
This commit is contained in:
parent
389125aeb8
commit
73280b0472
@ -39,6 +39,10 @@ pub trait One {
|
||||
static pure fn one() -> Self;
|
||||
}
|
||||
|
||||
pub pure fn abs<T: cmp::Ord Num Zero>(v: T) -> T {
|
||||
if v < Zero::zero() { v.neg() } else { v }
|
||||
}
|
||||
|
||||
pub trait Round {
|
||||
pure fn round(&self, mode: RoundMode) -> Self;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user