pub fn exp<T: CordicNumber>(x: T) -> T {
    assert!(
        T::num_fract_bits() <= 128,
        "Exp is not supported for more than 128 decimals."
    );
    let _0 = T::zero();
    let _1 = T::one();
    let _3 = T::one() + T::one() + T::one();
    let mut int_part = x.floor();
    let mut dec_part = x - int_part;
    let mut poweroftwo = T::half();
    let mut w = [false; 128];

    for i in 0..T::num_fract_bits() {
        if poweroftwo < dec_part {
            w[i as usize] = true;
            dec_part -= poweroftwo;
        }

        poweroftwo = poweroftwo >> 1;
    }

    let mut fx = _1;

    for i in 0..T::num_fract_bits() {
        if w[i as usize] {
            let ai = T::from_u0f64(lookup_table(EXP_MINUS_ONE_TABLE, i)) + T::one();
            fx = fx * ai;
        }
    }

    let f4 = _1 + (dec_part >> 2);
    let f3 = _1 + (dec_part / _3) * f4;
    let f2 = _1 + (dec_part >> 1) * f3;
    let f1 = _1 + dec_part * f2;
    fx = fx * f1;

    if int_part < _0 {
        while int_part != _0 {
            fx = fx / T::e();
            int_part += _1;
        }
    } else {
        while int_part != _0 {
            fx = fx * T::e();
            int_part -= _1;
        }
    }

    fx
}
/// Compute the exponential root of the given fixed-point number.
Compute the exponential root of the given fixed-point number.
Compute the exponential root of the given fixed - point number .
pub fn exp<T: CordicNumber>(x: T) -> T {
    assert!(
        T::num_fract_bits() <= 128,
        "Exp is not supported for more than 128 decimals."
    );
    let _0 = T::zero();
    let _1 = T::one();
    let _3 = T::one() + T::one() + T::one();
    let mut int_part = x.floor();
    let mut dec_part = x - int_part;
    let mut poweroftwo = T::half();
    let mut w = [false; 128];
    for i in 0..T::num_fract_bits() {
        if poweroftwo < dec_part {
            w[i as usize] = true;
            dec_part -= poweroftwo;
        }
        poweroftwo = poweroftwo >> 1;
    }
    let mut fx = _1;
    for i in 0..T::num_fract_bits() {
        if w[i as usize] {
            let ai = T::from_u0f64(lookup_table(EXP_MINUS_ONE_TABLE, i)) + T::one();
            fx = fx * ai;
        }
    }
    let f4 = _1 + (dec_part >> 2);
    let f3 = _1 + (dec_part / _3) * f4;
    let f2 = _1 + (dec_part >> 1) * f3;
    let f1 = _1 + dec_part * f2;
    fx = fx * f1;
    if int_part < _0 {
        while int_part != _0 {
            fx = fx / T::e();
            int_part += _1;
        }
    } else {
        while int_part != _0 {
            fx = fx * T::e();
            int_part -= _1;
        }
    }
    fx
}
pub fn exp < T : CordicNumber > ( x : T ) -> T { assert ! ( T num_fract_bits ( ) 128 " " ) ; let _0 = T :: zero ( ) ; let _1 = T :: one ( ) ; let _3 = T :: one ( ) + T :: one ( ) + T :: one ( ) ; let mut int_part = x . floor ( ) ; let mut dec_part = x - int_part ; let mut poweroftwo = T :: half ( ) ; let mut w = [ false ; 128 ] ; for i in 0 .. T :: num_fract_bits ( ) { if poweroftwo < dec_part { w [ i as usize ] = true ; dec_part -= poweroftwo ; } poweroftwo = poweroftwo >> 1 ; } let mut fx = _1 ; for i in 0 .. T :: num_fract_bits ( ) { if w [ i as usize ] { let ai = T :: from_u0f64 ( lookup_table ( EXP_MINUS_ONE_TABLE , i ) ) + T :: one ( ) ; fx = fx * ai ; } } let f4 = _1 + ( dec_part >> 2 ) ; let f3 = _1 + ( dec_part / _3 ) * f4 ; let f2 = _1 + ( dec_part >> 1 ) * f3 ; let f1 = _1 + dec_part * f2 ; fx = fx * f1 ; if int_part < _0 { while int_part != _0 { fx = fx / T :: e ( ) ; int_part += _1 ; } } else { while int_part != _0 { fx = fx * T :: e ( ) ; int_part -= _1 ; } } fx }
Compute the exponential root of the given fixed-point number.
Compute the exponential root of the given fixed - point number .
x
T