diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-03-06 09:28:55 -0500 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-04-03 13:54:29 -0400 |
| commit | 97bbe2d86a3c35f970266dfa1a9bd9a878d629f3 (patch) | |
| tree | 2878690c77839b07f074f06137a229f1022f9500 | |
| parent | 07247a001f43ddc35235202fc203159fbf081449 (diff) | |
| download | rust-97bbe2d86a3c35f970266dfa1a9bd9a878d629f3.tar.gz rust-97bbe2d86a3c35f970266dfa1a9bd9a878d629f3.zip | |
Fix normal and subnormal classification
| -rw-r--r-- | crates/core_simd/src/vector/float.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/core_simd/src/vector/float.rs b/crates/core_simd/src/vector/float.rs index 85456e7bf1e..bea711a5035 100644 --- a/crates/core_simd/src/vector/float.rs +++ b/crates/core_simd/src/vector/float.rs @@ -79,15 +79,14 @@ macro_rules! impl_float_vector { /// Returns true for each lane if its value is subnormal. #[inline] pub fn is_subnormal(self) -> crate::$mask_ty<LANES> { - let exponent_mask = crate::$bits_ty::splat(!0 << <$type>::MANTISSA_DIGITS); - self.abs().lanes_ne(Self::splat(0.0)) & (self.to_bits() & exponent_mask).lanes_eq(crate::$bits_ty::splat(0)) + self.abs().lanes_ne(Self::splat(0.0)) & (self.to_bits() & Self::splat(<$type>::INFINITY).to_bits()).lanes_eq(crate::$bits_ty::splat(0)) } /// Returns true for each lane if its value is neither neither zero, infinite, /// subnormal, or `NaN`. #[inline] pub fn is_normal(self) -> crate::$mask_ty<LANES> { - !(self.abs().lanes_eq(Self::splat(0.0)) | self.is_nan() | self.is_subnormal()) + !(self.abs().lanes_eq(Self::splat(0.0)) | self.is_nan() | self.is_subnormal() | self.is_infinite()) } } }; |
