Skip to main content

FloatOps

Trait FloatOps 

Source
pub trait FloatOps<T: Elem>: NumOps<T> {
    type Int: Simd;

    // Required methods
    fn div(self, x: Self::Simd, y: Self::Simd) -> Self::Simd;
    fn round_ties_even(self, x: Self::Simd) -> Self::Simd;
    fn to_int_trunc(self, x: Self::Simd) -> Self::Int;
    fn to_int_round(self, x: Self::Simd) -> Self::Int;

    // Provided methods
    fn reciprocal(self, x: Self::Simd) -> Self::Simd { ... }
    fn neg(self, x: Self::Simd) -> Self::Simd { ... }
    fn abs(self, x: Self::Simd) -> Self::Simd { ... }
    fn mul_sub_from(
        self,
        a: Self::Simd,
        b: Self::Simd,
        c: Self::Simd,
    ) -> Self::Simd { ... }
}
Expand description

Operations available on SIMD vectors with float elements.

Required Associated Types§

Source

type Int: Simd

Integer SIMD vector of the same bit-width as this vector.

Required Methods§

Source

fn div(self, x: Self::Simd, y: Self::Simd) -> Self::Simd

Compute x / y

Source

fn round_ties_even(self, x: Self::Simd) -> Self::Simd

Round x to the nearest integer value, with ties to even.

This is like f32::round_ties_even.

Source

fn to_int_trunc(self, x: Self::Simd) -> Self::Int

Convert each lane to an integer of the same width, rounding towards zero.

Source

fn to_int_round(self, x: Self::Simd) -> Self::Int

Convert each lane to an integer of the same width, rounding to nearest with ties to even.

Provided Methods§

Source

fn reciprocal(self, x: Self::Simd) -> Self::Simd

Compute 1. / x

Source

fn neg(self, x: Self::Simd) -> Self::Simd

Compute -x

Source

fn abs(self, x: Self::Simd) -> Self::Simd

Compute the absolute value of x

Source

fn mul_sub_from(self, a: Self::Simd, b: Self::Simd, c: Self::Simd) -> Self::Simd

Compute c - a * b.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§