Fix is_subnormal on architectures that flush subnormals to zero
This commit is contained in:
parent
7c7dbe0c50
commit
11c43c0c16
@ -336,7 +336,10 @@ fn is_finite(self) -> Self::Mask {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_subnormal(self) -> Self::Mask {
|
fn is_subnormal(self) -> Self::Mask {
|
||||||
self.abs().simd_ne(Self::splat(0.0)) & (self.to_bits() & Self::splat(Self::Scalar::INFINITY).to_bits()).simd_eq(Simd::splat(0))
|
// On some architectures (e.g. armv7 and some ppc) subnormals are flushed to zero,
|
||||||
|
// so this comparison must be done with integers.
|
||||||
|
let not_zero = self.abs().to_bits().simd_ne(Self::splat(0.0).to_bits());
|
||||||
|
not_zero & (self.to_bits() & Self::splat(Self::Scalar::INFINITY).to_bits()).simd_eq(Simd::splat(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
Loading…
Reference in New Issue
Block a user