File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 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;
7878
7979macro_rules! guess {
8080 ( $ty: ty) => {
81- const { ( INITIAL_GUESS >> ( u128 :: BITS - <$ty>:: BITS ) ) as $ty }
81+ const { ( C_U128 >> ( u128 :: BITS - <$ty>:: BITS ) ) as $ty }
8282 } ;
8383}
8484
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+ }
8696
8797/// Type-specific configuration used for float division
8898trait FloatDivision : Float
8999where
90100 Self :: Int : DInt ,
91101{
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.
96102 const C_HW : HalfRep < Self > ;
97103}
98104
You can’t perform that action at this time.
0 commit comments