File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,9 @@ version = "0.1.0"
4
4
edition = " 2021"
5
5
publish = false
6
6
7
- [dependencies .proptest ]
8
- version = " 0.10"
9
- default-features = false
10
- features = [" alloc" ]
7
+ [dependencies ]
8
+ float_eq = " 1.0"
9
+ proptest = { version = " 0.10" , default-features = false , features = [" alloc" ] }
11
10
12
11
[features ]
13
12
all_lane_counts = []
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ macro_rules! impl_float_biteq {
40
40
fn biteq( & self , other: & Self ) -> bool {
41
41
if self . is_nan( ) && other. is_nan( ) {
42
42
true // exact nan bits don't matter
43
+ } else if crate :: flush_subnormals:: <Self >( ) {
44
+ self . to_bits( ) == other. to_bits( ) || float_eq:: float_eq!( self , other, abs <= 2. * <$type>:: EPSILON )
43
45
} else {
44
46
self . to_bits( ) == other. to_bits( )
45
47
}
Original file line number Diff line number Diff line change @@ -6,6 +6,19 @@ pub mod wasm;
6
6
#[ macro_use]
7
7
pub mod biteq;
8
8
9
+ /// Indicates if subnormal floats are flushed to zero.
10
+ pub fn flush_subnormals < T > ( ) -> bool {
11
+ let is_f32 = core:: mem:: size_of :: < T > ( ) == 4 ;
12
+ let ppc_flush = is_f32
13
+ && cfg ! ( all(
14
+ target_arch = "powerpc64" ,
15
+ target_endian = "big" ,
16
+ not( target_feature = "vsx" )
17
+ ) ) ;
18
+ let arm_flush = is_f32 && cfg ! ( all( target_arch = "arm" , target_feature = "neon" ) ) ;
19
+ ppc_flush || arm_flush
20
+ }
21
+
9
22
/// Specifies the default strategy for testing a type.
10
23
///
11
24
/// This strategy should be what "makes sense" to test.
You can’t perform that action at this time.
0 commit comments