pub fn asin<T: CordicNumber>(mut val: T) -> T {
    // For asin, we use a double-rotation approach to reduce errors.
    // NOTE: see https://stackoverflow.com/questions/25976656/cordic-arcsine-implementation-fails
    // for details about the innacuracy of CORDIC for asin.

    let mut theta = T::zero();
    let mut z = (T::one(), T::zero());
    let niter = T::num_fract_bits();

    for j in 0..niter {
        let sign_x = if z.0 < T::zero() { -T::one() } else { T::one() };
        let sigma = if z.1 <= val { sign_x } else { -sign_x };
        let rotate = |(x, y)| (x - ((y >> j) * sigma), y + ((x >> j) * sigma));
        z = rotate(rotate(z));

        let angle = T::from_u0f64(lookup_table(ATAN_TABLE, j));
        theta = theta + ((angle + angle) * sigma);
        val = val + (val >> (j + j));
    }

    theta
}
/// Compute the arc-sinus of the given fixed-point number.
Compute the arc-sinus of the given fixed-point number.
Compute the arc - sinus of the given fixed - point number .
pub fn asin<T: CordicNumber>(mut val: T) -> T {
    // For asin, we use a double-rotation approach to reduce errors.
    // NOTE: see https://stackoverflow.com/questions/25976656/cordic-arcsine-implementation-fails
    // for details about the innacuracy of CORDIC for asin.
    let mut theta = T::zero();
    let mut z = (T::one(), T::zero());
    let niter = T::num_fract_bits();
    for j in 0..niter {
        let sign_x = if z.0 < T::zero() { -T::one() } else { T::one() };
        let sigma = if z.1 <= val { sign_x } else { -sign_x };
        let rotate = |(x, y)| (x - ((y >> j) * sigma), y + ((x >> j) * sigma));
        z = rotate(rotate(z));
        let angle = T::from_u0f64(lookup_table(ATAN_TABLE, j));
        theta = theta + ((angle + angle) * sigma);
        val = val + (val >> (j + j));
    }
    theta
}
pub fn asin < T : CordicNumber > ( mut val : T ) -> T { // For asin, we use a double-rotation approach to reduce errors. // NOTE: see https://stackoverflow.com/questions/25976656/cordic-arcsine-implementation-fails // for details about the innacuracy of CORDIC for asin. let mut theta = T :: zero ( ) ; let mut z = ( T :: one ( ) , T :: zero ( ) ) ; let niter = T :: num_fract_bits ( ) ; for j in 0 .. niter { let sign_x = if z . 0 < T :: zero ( ) { - T :: one ( ) } else { T :: one ( ) } ; let sigma = if z . 1 <= val { sign_x } else { - sign_x } ; let rotate = | ( x , y ) | ( x - ( ( y >> j ) * sigma ) , y + ( ( x >> j ) * sigma ) ) ; z = rotate ( rotate ( z ) ) ; let angle = T :: from_u0f64 ( lookup_table ( ATAN_TABLE , j ) ) ; theta = theta + ( ( angle + angle ) * sigma ) ; val = val + ( val >> ( j + j ) ) ; } theta }
Compute the arc-sinus of the given fixed-point number.
Compute the arc - sinus of the given fixed - point number .
val
T