@@ -104,7 +104,7 @@ where
104
104
///
105
105
/// ASSUMPTION: the initial estimate should have at least 8 bits of precision. If this is not
106
106
/// true, results will be inaccurate.
107
- const fn calc_iterations < F : Float > ( ) -> ( usize , usize ) {
107
+ const fn get_iterations < F : Float > ( ) -> ( usize , usize ) {
108
108
// Precision doubles with each iteration
109
109
let total_iterations = F :: BITS . ilog2 ( ) as usize - 2 ;
110
110
@@ -137,16 +137,7 @@ const fn calc_iterations<F: Float>() -> (usize, usize) {
137
137
///
138
138
/// Add 2 to U_N due to final decrement.
139
139
const fn reciprocal_precision < F : Float > ( ) -> u16 {
140
- let ( half_iterations, full_iterations) = calc_iterations :: < F > ( ) ;
141
-
142
- // if !Self::USE_NATIVE_FULL_ITERATIONS {
143
- // if Self::FULL_ITERATIONS != 1 {
144
- // panic!("Only a single emulated full iteration is supported");
145
- // }
146
- // if !(Self::HALF_ITERATIONS > 0) {
147
- // panic!("Invalid number of half iterations");
148
- // }
149
- // }
140
+ let ( half_iterations, full_iterations) = get_iterations :: < F > ( ) ;
150
141
151
142
if full_iterations < 1 {
152
143
panic ! ( "Must have at least one full iteration" ) ;
@@ -248,7 +239,7 @@ where
248
239
let inf_rep = exponent_mask;
249
240
let quiet_bit = implicit_bit >> 1 ;
250
241
let qnan_rep = exponent_mask | quiet_bit;
251
- let ( half_iterations, full_iterations) = calc_iterations :: < F > ( ) ;
242
+ let ( half_iterations, full_iterations) = get_iterations :: < F > ( ) ;
252
243
let recip_precision = reciprocal_precision :: < F > ( ) ;
253
244
254
245
let a_rep = a. repr ( ) ;
@@ -640,6 +631,15 @@ where
640
631
F :: from_repr ( abs_result | quotient_sign)
641
632
}
642
633
634
+ fn iter_once < I > ( x_uq0 : I , b_uq1 : I ) -> I
635
+ where
636
+ I : Int + HInt ,
637
+ <I as HInt >:: D : ops:: Shr < u32 , Output = <I as HInt >:: D > ,
638
+ {
639
+ let corr_uq1: I = I :: ZERO . wrapping_sub ( x_uq0. widen_mul ( b_uq1) . hi ( ) ) ;
640
+ ( x_uq0. widen_mul ( corr_uq1) >> ( I :: BITS - 1 ) ) . lo ( )
641
+ }
642
+
643
643
intrinsics ! {
644
644
#[ avr_skip]
645
645
#[ arm_aeabi_alias = __aeabi_fdiv]
0 commit comments