Знатоки C/C++ - фигейте вместе со мной!
Sep. 30th, 2003 02:25 pmУ меня проект "достался по наследству". В нём дофигищща исходников.
Я 2 дня искал один баг пока не наткнулся на эту потрясающую функцию (что используется примерно раз в секунду или чаще)
double DB_ADOGeneral::FloatToDouble(float floatNum, int precision)
// DESCRIPTION: Converts namber of tupe float to double tupe,
// The precision value specifies the number of digits
// after the decimal point.
/////////////////////////////////////////////////////////////////
{
TCHAR* tc[40];
CString cs;
LPTSTR endptr;
double db = 0;
cs.Format(_T("%.*f"),precision,floatNum);
tc = new TCHAR[cs.GetLength()-1];
memset(tc,'\0',sizeof(tc));
lstrcpy(tc,cs);
db = _tcstod(tc,&endptr);
return db;
}
Я 2 дня искал один баг пока не наткнулся на эту потрясающую функцию (что используется примерно раз в секунду или чаще)
double DB_ADOGeneral::FloatToDouble(float floatNum, int precision)
// DESCRIPTION: Converts namber of tupe float to double tupe,
// The precision value specifies the number of digits
// after the decimal point.
/////////////////////////////////////////////////////////////////
{
TCHAR* tc[40];
CString cs;
LPTSTR endptr;
double db = 0;
cs.Format(_T("%.*f"),precision,floatNum);
tc = new TCHAR[cs.GetLength()-1];
memset(tc,'\0',sizeof(tc));
lstrcpy(tc,cs);
db = _tcstod(tc,&endptr);
return db;
}
Да идиот он (можно сказать, что "был")
Date: 2003-09-30 05:31 am (UTC)(c) Suzane Vega
:-)