ExtNum

Trait ExtNum 

Source
pub trait ExtNum: Clone {
    type AbsOut: Clone + ExtNum<AbsOut = Self::AbsOut>;

    const ABS_UNCHANGED: bool;
    const ABS_SAME_TYPE: bool;

    // Required methods
    fn ext_abs(self) -> Self::AbsOut;
    fn ext_abs_diff(self, other: Self) -> Self::AbsOut;
    fn ext_real(self) -> Self::AbsOut;
    fn ext_imag(self) -> Self::AbsOut;

    // Provided method
    fn is_nan(&self) -> bool { ... }
}

Required Associated Constants§

Source

const ABS_UNCHANGED: bool

Whether the absolute value operation does not change the value.

Source

const ABS_SAME_TYPE: bool

Whether the output type of the absolute value operation is the same as the input type.

Required Associated Types§

Source

type AbsOut: Clone + ExtNum<AbsOut = Self::AbsOut>

The output type of the absolute value operation.

Required Methods§

Source

fn ext_abs(self) -> Self::AbsOut

Computes the absolute value of the number.

Source

fn ext_abs_diff(self, other: Self) -> Self::AbsOut

Computes the absolute difference between two numbers.

For most cases, this is equivalent to (self - other).ext_abs(). However, for unsigned integer types, this avoids potential underflow.

Source

fn ext_real(self) -> Self::AbsOut

Returns the real part of the number.

Source

fn ext_imag(self) -> Self::AbsOut

Returns the imaginary part of the number.

Provided Methods§

Source

fn is_nan(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ExtNum for f32

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = f32

Source§

fn ext_abs(self) -> f32

Source§

fn ext_abs_diff(self, other: f32) -> f32

Source§

fn ext_real(self) -> f32

Source§

fn ext_imag(self) -> f32

Source§

fn is_nan(&self) -> bool

Source§

impl ExtNum for f64

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = f64

Source§

fn ext_abs(self) -> f64

Source§

fn ext_abs_diff(self, other: f64) -> f64

Source§

fn ext_real(self) -> f64

Source§

fn ext_imag(self) -> f64

Source§

fn is_nan(&self) -> bool

Source§

impl ExtNum for i8

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = i8

Source§

fn ext_abs(self) -> i8

Source§

fn ext_abs_diff(self, other: i8) -> i8

Source§

fn ext_real(self) -> i8

Source§

fn ext_imag(self) -> i8

Source§

impl ExtNum for i16

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = i16

Source§

fn ext_abs(self) -> i16

Source§

fn ext_abs_diff(self, other: i16) -> i16

Source§

fn ext_real(self) -> i16

Source§

fn ext_imag(self) -> i16

Source§

impl ExtNum for i32

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = i32

Source§

fn ext_abs(self) -> i32

Source§

fn ext_abs_diff(self, other: i32) -> i32

Source§

fn ext_real(self) -> i32

Source§

fn ext_imag(self) -> i32

Source§

impl ExtNum for i64

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = i64

Source§

fn ext_abs(self) -> i64

Source§

fn ext_abs_diff(self, other: i64) -> i64

Source§

fn ext_real(self) -> i64

Source§

fn ext_imag(self) -> i64

Source§

impl ExtNum for i128

Source§

impl ExtNum for isize

Source§

impl ExtNum for u8

Source§

const ABS_UNCHANGED: bool = true

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = u8

Source§

fn ext_abs(self) -> u8

Source§

fn ext_abs_diff(self, other: u8) -> u8

Source§

fn ext_real(self) -> u8

Source§

fn ext_imag(self) -> u8

Source§

impl ExtNum for u16

Source§

impl ExtNum for u32

Source§

impl ExtNum for u64

Source§

impl ExtNum for u128

Source§

impl ExtNum for usize

Source§

impl ExtNum for bf16

Source§

impl ExtNum for f16

Source§

const ABS_UNCHANGED: bool = false

Source§

const ABS_SAME_TYPE: bool = true

Source§

type AbsOut = f16

Source§

fn ext_abs(self) -> f16

Source§

fn ext_abs_diff(self, other: f16) -> f16

Source§

fn ext_real(self) -> f16

Source§

fn ext_imag(self) -> f16

Source§

fn is_nan(&self) -> bool

Source§

impl ExtNum for Complex<f32>

Source§

impl ExtNum for Complex<f64>

Implementors§