fn rempi(a: f64) -> (Doubled<f64>, i32) {
    let mut ex = ilogb2k(a) - 55;
    let q = if ex > (700 - 55) { -64 } else { 0 };
    let a = ldexp3k(a, q);
    if ex < 0 {
        ex = 0;
    }
    let ex = (ex * 4) as usize;
    let mut x = a.mul_as_doubled(crate::tables::REMPITABDP[ex]);
    let (did, dii) = rempisub(x.0);
    let mut q = dii;
    x.0 = did;
    x = x.normalize();
    let mut y = a.mul_as_doubled(crate::tables::REMPITABDP[ex + 1]);
    x += y;
    let (did, dii) = rempisub(x.0);
    q += dii;
    x.0 = did;
    x = x.normalize();
    y = dd(
        crate::tables::REMPITABDP[ex + 2],
        crate::tables::REMPITABDP[ex + 3],
    ) * a;
    x += y;
    x = x.normalize()
        * dd(
            3.141_592_653_589_793_116 * 2.,
            1.224_646_799_147_353_207_2_e-16 * 2.,
        );
    (if fabsk(a) < 0.7 { dd(a, 0.) } else { x }, q)
}
// Payne-Hanek like argument reduction
Payne-Hanek like argument reduction
Payne - Hanek like argument reduction
fn rempi(a: f64) -> (Doubled<f64>, i32) {
    let mut ex = ilogb2k(a) - 55;
    let q = if ex > (700 - 55) { -64 } else { 0 };
    let a = ldexp3k(a, q);
    if ex < 0 {
        ex = 0;
    }
    let ex = (ex * 4) as usize;
    let mut x = a.mul_as_doubled(crate::tables::REMPITABDP[ex]);
    let (did, dii) = rempisub(x.0);
    let mut q = dii;
    x.0 = did;
    x = x.normalize();
    let mut y = a.mul_as_doubled(crate::tables::REMPITABDP[ex + 1]);
    x += y;
    let (did, dii) = rempisub(x.0);
    q += dii;
    x.0 = did;
    x = x.normalize();
    y = dd(
        crate::tables::REMPITABDP[ex + 2],
        crate::tables::REMPITABDP[ex + 3],
    ) * a;
    x += y;
    x = x.normalize()
        * dd(
            3.141_592_653_589_793_116 * 2.,
            1.224_646_799_147_353_207_2_e-16 * 2.,
        );
    (if fabsk(a) < 0.7 { dd(a, 0.) } else { x }, q)
}
fn rempi ( a : f64 ) -> ( Doubled < f64 > , i32 ) { let mut ex = ilogb2k ( a ) - 55 ; let q = if ex > ( 700 - 55 ) { - 64 } else { 0 } ; let a = ldexp3k ( a , q ) ; if ex < 0 { ex = 0 ; } let ex = ( ex * 4 ) as usize ; let mut x = a . mul_as_doubled ( crate :: tables :: REMPITABDP [ ex ] ) ; let ( did , dii ) = rempisub ( x . 0 ) ; let mut q = dii ; x . 0 = did ; x = x . normalize ( ) ; let mut y = a . mul_as_doubled ( crate :: tables :: REMPITABDP [ ex + 1 ] ) ; x += y ; let ( did , dii ) = rempisub ( x . 0 ) ; q += dii ; x . 0 = did ; x = x . normalize ( ) ; y = dd ( crate :: tables :: REMPITABDP [ ex + 2 ] , crate :: tables :: REMPITABDP [ ex + 3 ] , ) * a ; x += y ; x = x . normalize ( ) * dd ( 3.141_592_653_589_793_116 * 2. , 1.224_646_799_147_353_207_2_e-16 * 2. , ) ; ( if fabsk ( a ) < 0.7 { dd ( a , 0. ) } else { x } , q ) }
Payne-Hanek like argument reduction
Payne - Hanek like argument reduction
a
f64
a
f64