Struct acid2::simd::SimdF64

source ·
pub struct SimdF64<const LANES: usize>(_)
where
    LaneCount<LANES>: SupportedLaneCount
;
Available on crate feature simd only.

Implementations§

The exponent of this 2-adic number.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::Simd;

let f = F64x8::splat(F64::from(8));

assert_eq!(f.exponent(), Simd::splat(3));

The part of this number coprime to 2.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::Simd;

let f = F64x8::splat(F64::from(8));

let f = F64x8::splat(F64::from(36));

assert_eq!(f.significand(), Simd::splat(9));

The exponent and significand of this number, packed together in a tuple.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::Simd;

let f = F64x8::splat(F64::from(12));

assert_eq!(f.exponent_and_significand(), (Simd::splat(2), Simd::splat(3)));

The 2-adic absolute value of this number.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdFloat};

let f = F64x8::splat(F64::from(72));

assert_eq!(f.abs(), Simd::splat(2f64.powi(-3)));
assert_eq!(F64x8::splat(F64::ZERO).abs(), Simd::splat(0.0));
assert_eq!(F64x8::splat(F64::INFINITY).abs(), Simd::splat(f64::INFINITY));
assert!(F64x8::splat(F64::NAN).abs().is_nan().all());

Whether or not this number is NaN.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::Simd;

let x = F64x8::splat(F64::ONE);
let y = F64x8::splat(F64::NAN);
let z = F64x8::splat(F64::INFINITY);

assert!(!x.is_nan().any());
assert!(y.is_nan().all());
assert!(!z.is_nan().any());

Whether or not this number is infinite.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::Simd;

let x = F64x8::splat(F64::ONE);
let y = F64x8::splat(F64::NAN);
let z = F64x8::splat(F64::INFINITY);

assert!(!x.is_infinite().any());
assert!(!y.is_infinite().any());
assert!(z.is_infinite().all());

Whether or not this number is finite.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::Simd;

let x = F64x8::splat(F64::ONE);
let y = F64x8::splat(F64::NAN);
let z = F64x8::splat(F64::INFINITY);

assert!(x.is_finite().all());
assert!(!y.is_finite().any());
assert!(!z.is_finite().any());

Computes the 2-adic square root of this number.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdPartialOrd};

let f = F64x8::splat(F64::from(81));
let sqrt = f.sqrt();

assert!((sqrt - F64x8::splat(F64::from(9))).abs().simd_le(Simd::splat(1e-15)).all()); // this won't always be true for perfect squares, but in this case it is
assert!((sqrt * sqrt - f).abs().simd_le(Simd::splat(1e-7)).all());

Computes the 2-adic reciprocal of this number.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdPartialOrd};

let f = F64x8::splat(F64::from(13));
let recip = f.recip();

assert!((f * recip - F64x8::splat(F64::ONE)).abs().simd_le(Simd::splat(1e-15)).all());

Trait Implementations§

Computes the 2-adic sum of two numbers, truncating on the left side where necessary.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdPartialOrd};

let x = F64x8::splat(F64::from(13));
let y = F64x8::splat(F64::from(11));

assert!((x + y - F64x8::splat(F64::from(24))).abs().simd_le(Simd::splat(1e-15)).all());
The resulting type after applying the + operator.
Performs the += operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Computes the 2-adic difference of two numbers, truncating on the left side where necessary.

x / y is exactly equivalent to x * y.recip().

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdPartialOrd};

let x = F64x8::splat(F64::from(18));
let y = F64x8::splat(F64::from(6));
assert!((x / y - F64x8::splat(F64::from(3))).abs().simd_le(Simd::splat(1e-15)).all());
The resulting type after applying the / operator.
Performs the /= operation. Read more

Computes the 2-adic product of two numbers, truncating on the left side where necessary.

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdPartialOrd};

let x = F64x8::splat(F64::from(14));
let y = F64x8::splat(F64::from(6));

assert!((x * y - F64x8::splat(F64::from(84))).abs().simd_le(Simd::splat(1e-15)).all());
The resulting type after applying the * operator.
Performs the *= operation. Read more
The resulting type after applying the - operator.
Performs the unary - operation. Read more

Computes the 2-adic difference of two numbers, truncating on the left side where necessary.

x - y is exactly equivalent to x + (-y).

Examples
#![feature(portable_simd)]
use acid2::{core::F64, simd::F64x8};
use core::simd::{Simd, SimdPartialOrd};

let x = F64x8::splat(F64::from(13));
let y = F64x8::splat(F64::from(11));

assert!((x - y - F64x8::splat(F64::from(2))).abs().simd_le(Simd::splat(1e-15)).all());
The resulting type after applying the - operator.
Performs the -= operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.