File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -78,21 +78,27 @@ use core::mem::size_of;
78
78
79
79
macro_rules! guess {
80
80
( $ty: ty) => {
81
- const { ( INITIAL_GUESS >> ( u128 :: BITS - <$ty>:: BITS ) ) as $ty }
81
+ const { ( C_U128 >> ( u128 :: BITS - <$ty>:: BITS ) ) as $ty }
82
82
} ;
83
83
}
84
84
85
- const INITIAL_GUESS : u128 = 0x7504f333f9de6108b2fb1366eaa6a542 ;
85
+ const C_U128 : u128 = 0x7504f333f9de6108b2fb1366eaa6a542 ;
86
+
87
+ /// C is (3/4 + 1/sqrt(2)) - 1 truncated to W0 fractional bits as UQ0.HW
88
+ /// with W0 being either 16 or 32 and W0 <= HW.
89
+ /// That is, C is the aforementioned 3/4 + 1/sqrt(2) constant (from which
90
+ /// b/2 is subtracted to obtain x0) wrapped to [0, 1) range.
91
+ macro_rules! half_width_c {
92
+ ( $ty: ty) => {
93
+ const { ( C_U128 >> ( u128 :: BITS - <$ty>:: BITS ) ) as $ty }
94
+ } ;
95
+ }
86
96
87
97
/// Type-specific configuration used for float division
88
98
trait FloatDivision : Float
89
99
where
90
100
Self :: Int : DInt ,
91
101
{
92
- /// C is (3/4 + 1/sqrt(2)) - 1 truncated to W0 fractional bits as UQ0.HW
93
- /// with W0 being either 16 or 32 and W0 <= HW.
94
- /// That is, C is the aforementioned 3/4 + 1/sqrt(2) constant (from which
95
- /// b/2 is subtracted to obtain x0) wrapped to [0, 1) range.
96
102
const C_HW : HalfRep < Self > ;
97
103
}
98
104
You can’t perform that action at this time.
0 commit comments