Trait num_traits::Signed
[−]
[src]
pub trait Signed: Sized + Neg<Output=Self> {
fn abs(&self) -> Self;
fn signum(&self) -> Self;
fn is_positive(&self) -> bool;
fn is_negative(&self) -> bool;
}Signed numbers.
Required Methods
fn abs(&self) -> Self
Computes the absolute value.
For f32 and f64, NaN will be returned if the number is NaN.
For signed integers, ::MIN will be returned if the number is ::MIN.
fn signum(&self) -> Self
Returns the sign of the number.
For f32 and f64:
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNaNif the number isNaN
For signed integers:
0if the number is zero1if the number is positive-1if the number is negative
fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.