Trait malachite_base::num::arithmetic::traits::Sign

source ·
pub trait Sign {
    // Required method
    fn sign(&self) -> Ordering;
}
Expand description

Returns Greater, Equal, or Less, depending on whether a number is positive, zero, or negative, respectively.

Required Methods§

source

fn sign(&self) -> Ordering

Implementations on Foreign Types§

source§

impl Sign for f32

source§

fn sign(&self) -> Ordering

Compares a number to zero.

  • Positive finite numbers, positive zero, and positive infinity have sign Greater.
  • Negative finite numbers, negative zero, and negative infinity have sign Less.
  • NaN has sign Equal.
§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for f64

source§

fn sign(&self) -> Ordering

Compares a number to zero.

  • Positive finite numbers, positive zero, and positive infinity have sign Greater.
  • Negative finite numbers, negative zero, and negative infinity have sign Less.
  • NaN has sign Equal.
§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for i8

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for i16

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for i32

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for i64

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for i128

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for isize

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for u8

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for u16

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for u32

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for u64

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for u128

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl Sign for usize

source§

fn sign(&self) -> Ordering

Compares a number to zero.

Returns Greater, Equal, or Less, depending on whether the number is positive, zero, or negative, respectively.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§