pub struct SimdF64<const LANES: usize>(_)
where
LaneCount<LANES>: SupportedLaneCount;simd only.Implementations§
source§impl<const LANES: usize> SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
pub fn splat(x: F64) -> Self
pub fn from_array(arr: [F64; LANES]) -> Self
sourcepub fn exponent(self) -> Simd<i16, LANES>
pub fn exponent(self) -> Simd<i16, LANES>
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));sourcepub fn significand(self) -> Simd<u64, LANES>
pub fn significand(self) -> Simd<u64, LANES>
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));sourcepub fn exponent_and_significand(self) -> (Simd<i16, LANES>, Simd<u64, LANES>)
pub fn exponent_and_significand(self) -> (Simd<i16, LANES>, Simd<u64, LANES>)
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)));sourcepub fn abs(self) -> Simd<f64, LANES>
pub fn abs(self) -> Simd<f64, LANES>
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());sourcepub fn is_nan(self) -> Mask<i64, LANES>
pub fn is_nan(self) -> Mask<i64, LANES>
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());sourcepub fn is_infinite(self) -> Mask<i64, LANES>
pub fn is_infinite(self) -> Mask<i64, LANES>
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());sourcepub fn is_finite(self) -> Mask<i64, LANES>
pub fn is_finite(self) -> Mask<i64, LANES>
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());sourcepub fn sqrt(self) -> Self
pub fn sqrt(self) -> Self
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());sourcepub fn recip(self) -> Self
pub fn recip(self) -> Self
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§
source§impl<const LANES: usize> Add<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> Add<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn add(self, rhs: Self) -> Self::Output
fn add(self, rhs: Self) -> Self::Output
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());source§impl<const LANES: usize> AddAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> AddAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moresource§impl<const LANES: usize> Div<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> Div<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn div(self, rhs: Self) -> Self::Output
fn div(self, rhs: Self) -> Self::Output
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());source§impl<const LANES: usize> DivAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> DivAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moresource§impl<const LANES: usize> Mul<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> Mul<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn mul(self, rhs: Self) -> Self::Output
fn mul(self, rhs: Self) -> Self::Output
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());source§impl<const LANES: usize> MulAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> MulAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moresource§impl<const LANES: usize> Sub<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> Sub<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn sub(self, rhs: Self) -> Self::Output
fn sub(self, rhs: Self) -> Self::Output
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());source§impl<const LANES: usize> SubAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
impl<const LANES: usize> SubAssign<SimdF64<LANES>> for SimdF64<LANES>where
LaneCount<LANES>: SupportedLaneCount,
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more