At 02:59 PM 6/3/99 -0700, you wrote:
>I am trying to convert a string to a float, using the FlpAToF routine as
>described in the knowledge base (with gcc). I included NewFloatMgr.h in my
>code, and then did the following:
>


int pow(int b, int e); // prototype ;]
int pow(int b, int e) { int i, x; x = 1; for(i=e;i>0;i--) x *= b; return x; }

void StrPrintFlp(FlpDouble f, char* acBuf, int iBufLen, int places)
{
        SDWord sdwVal, sdwRem;
        FlpDouble fRem;
                                        
        DMemSet(acBuf, '\0', iBufLen);
        _fp_round(flpToNearest);
        sdwVal = _d_dtou(f);
        fRem = _d_add(_d_mul(_d_sub(f, _d_utod(sdwVal)),
_d_utod(pow(10,places+1))), _d_utod(5));
        sdwRem = _d_dtou(_d_div(fRem, _d_utod(10)));
        StrPrintF(acBuf, "%ld.%1ld", sdwVal, sdwRem);
}


Reply via email to