@@ -213,8 +213,8 @@ impl ArrayStaticFilter {
213213 }
214214}
215215
216- /// Wrapper for f32 that implements Hash and Eq using IEEE 754 total ordering .
217- /// This treats NaN values as equal to each other (using total_cmp) .
216+ /// Wrapper for f32 that implements Hash and Eq using bit comparison .
217+ /// This treats NaN values as equal to each other when they have the same bit pattern .
218218#[ derive( Clone , Copy ) ]
219219struct OrderedFloat32 ( f32 ) ;
220220
@@ -226,7 +226,7 @@ impl Hash for OrderedFloat32 {
226226
227227impl PartialEq for OrderedFloat32 {
228228 fn eq ( & self , other : & Self ) -> bool {
229- self . 0 . total_cmp ( & other. 0 ) . is_eq ( )
229+ self . 0 . to_bits ( ) == other. 0 . to_bits ( )
230230 }
231231}
232232
@@ -238,8 +238,8 @@ impl From<f32> for OrderedFloat32 {
238238 }
239239}
240240
241- /// Wrapper for f64 that implements Hash and Eq using IEEE 754 total ordering .
242- /// This treats NaN values as equal to each other (using total_cmp) .
241+ /// Wrapper for f64 that implements Hash and Eq using bit comparison .
242+ /// This treats NaN values as equal to each other when they have the same bit pattern .
243243#[ derive( Clone , Copy ) ]
244244struct OrderedFloat64 ( f64 ) ;
245245
@@ -251,7 +251,7 @@ impl Hash for OrderedFloat64 {
251251
252252impl PartialEq for OrderedFloat64 {
253253 fn eq ( & self , other : & Self ) -> bool {
254- self . 0 . total_cmp ( & other. 0 ) . is_eq ( )
254+ self . 0 . to_bits ( ) == other. 0 . to_bits ( )
255255 }
256256}
257257
0 commit comments