You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When values are not comparable, these methods always return the second value.
An example of this is calling simd_min on a valid f32 and f32::NAN:
let number = 1.0f32;let nan = f32::NAN;println!("{}", number.simd_min(nan));// Prints "NaN"println!("{}", nan.simd_min(number));// Prints "1"
This happens because the current implementation of simd_min is the following:
fnsimd_min(self,other:Self) -> Self{ifself <= other {self}else{
other
}}
and a <= (or any syntax-sugared comparison in general) between two instances of a PartialOrd type where a.partial_ord(&b) returns None is evaluated to false.
The text was updated successfully, but these errors were encountered:
On a side note, all the other comparison methods under SimdPartialOrd will return a bool regardless of whether the values are actually comparable or not. I imagine this is either SIMD requirement or a convenience choice, but at this point isn't the trait behaving more like a SimdOrd which is implemented for PartialOrd types like f32 and f64 for convenience?
When values are not comparable, these methods always return the second value.
An example of this is calling
simd_min
on a validf32
andf32::NAN
:This happens because the current implementation of
simd_min
is the following:and a
<=
(or any syntax-sugared comparison in general) between two instances of aPartialOrd
type wherea.partial_ord(&b)
returnsNone
is evaluated tofalse
.The text was updated successfully, but these errors were encountered: