release/src/linux/linux/arch/arm/nwfpe/softfloat.c
/*
-------------------------------------------------------------------------------
Returns the square root of the double-precision floating-point value `a'.
The operation is performed according to the IEC/IEEE Standard for Binary
Floating-point Arithmetic.
-------------------------------------------------------------------------------
*/
Returns the square root of the double-precision floating-point value `a'.
The operation is performed according to the IEC/IEEE Standard for Binary
Floating-point Arithmetic.
Returns the square root of the double - precision floating - point value ` a ' . The operation is performed according to the IEC / IEEE Standard for Binary Floating - point Arithmetic .
float64 float64_sqrt( float64 a )
{
    flag aSign;
    int16 aExp, zExp;
    bits64 aSig, zSig;
    bits64 rem0, rem1, term0, term1; 
    aSig = extractFloat64Frac( a );
    aExp = extractFloat64Exp( a );
    aSign = extractFloat64Sign( a );
    if ( aExp == 0x7FF ) {
        if ( aSig ) return propagateFloat64NaN( a, a );
        if ( ! aSign ) return a;
        float_raise( float_flag_invalid );
        return float64_default_nan;
    }
    if ( aSign ) {
        if ( ( aExp | aSig ) == 0 ) return a;
        float_raise( float_flag_invalid );
        return float64_default_nan;
    }
    if ( aExp == 0 ) {
        if ( aSig == 0 ) return 0;
        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
    }
    zExp = ( ( aExp - 0x3FF )>>1 ) + 0x3FE;
    aSig |= LIT64( 0x0010000000000000 );
    zSig = estimateSqrt32( aExp, aSig>>21 );
    zSig <<= 31;
    aSig <<= 9 - ( aExp & 1 );
    zSig = estimateDiv128To64( aSig, 0, zSig ) + zSig + 2;
    if ( ( zSig & 0x3FF ) <= 5 ) {
        if ( zSig < 2 ) {
            zSig = LIT64( 0xFFFFFFFFFFFFFFFF );
        }
        else {
            aSig <<= 2;
            mul64To128( zSig, zSig, &term0, &term1 );
            sub128( aSig, 0, term0, term1, &rem0, &rem1 );
            while ( (sbits64) rem0 < 0 ) {
                --zSig;
                shortShift128Left( 0, zSig, 1, &term0, &term1 );
                term1 |= 1;
                add128( rem0, rem1, term0, term1, &rem0, &rem1 );
            }
            zSig |= ( ( rem0 | rem1 ) != 0 );
        }
    }
    shift64RightJamming( zSig, 1, &zSig );
    return roundAndPackFloat64( 0, zExp, zSig );
}
float64 float64_sqrt ( float64 a ) { flag aSign ; int16 aExp , zExp ; bits64 aSig , zSig ; bits64 rem0 , rem1 , term0 , term1 ; aSig = extractFloat64Frac ( a ) ; aExp = extractFloat64Exp ( a ) ; aSign = extractFloat64Sign ( a ) ; if ( aExp == 0x7FF ) { if ( aSig ) return propagateFloat64NaN ( a , a ) ; if ( ! aSign ) return a ; float_raise ( float_flag_invalid ) ; return float64_default_nan ; } if ( aSign ) { if ( ( aExp | aSig ) == 0 ) return a ; float_raise ( float_flag_invalid ) ; return float64_default_nan ; } if ( aExp == 0 ) { if ( aSig == 0 ) return 0 ; normalizeFloat64Subnormal ( aSig , & aExp , & aSig ) ; } zExp = ( ( aExp - 0x3FF ) >> 1 ) + 0x3FE ; aSig |= LIT64 ( 0x0010000000000000 ) ; zSig = estimateSqrt32 ( aExp , aSig >> 21 ) ; zSig <<= 31 ; aSig <<= 9 - ( aExp & 1 ) ; zSig = estimateDiv128To64 ( aSig , 0 , zSig ) + zSig + 2 ; if ( ( zSig & 0x3FF ) <= 5 ) { if ( zSig < 2 ) { zSig = LIT64 ( 0xFFFFFFFFFFFFFFFF ) ; } else { aSig <<= 2 ; mul64To128 ( zSig , zSig , & term0 , & term1 ) ; sub128 ( aSig , 0 , term0 , term1 , & rem0 , & rem1 ) ; while ( ( sbits64 ) rem0 < 0 ) { -- zSig ; shortShift128Left ( 0 , zSig , 1 , & term0 , & term1 ) ; term1 |= 1 ; add128 ( rem0 , rem1 , term0 , term1 , & rem0 , & rem1 ) ; } zSig |= ( ( rem0 | rem1 ) != 0 ) ; } } shift64RightJamming ( zSig , 1 , & zSig ) ; return roundAndPackFloat64 ( 0 , zExp , zSig ) ; }
Returns the square root of the double-precision floating-point value `a'.
Returns the square root of the double - precision floating - point value ` a ' .
//, shiftedRem; //float64 z;