Hola,
Con lo de mantisa y exponente... te refieres a, por ejemplo:
12345678901234567890 = 1,234 e+20
0,0000000001234567890 = 1,234 e-10
esto?
en cuanto a lo de los decimales... echa un vistazo a estas dos funciones que me hice para presentar resultados en pantalla dentro de mi proyecto. Algo de ahi puede que te sirva. Estan hechas en VC++, asi que habra cosas que tendras que adaptar, por ejemplo pasar de CString a char*[] y cosas asi, pero la idea ya la tienes. Adaptar esto a lo de arriba no te deberia costar demasiado, suerte
CString CMyDoc::CutAndRoundStringToNDecimals (double dValue, const int nDec)
{
double dTemp = 0, dFract = 0, dInt = 0, dRes = 0;
int nCount = 0;
CString cLetter = "";
//Operations to round up the nth decimal number if necessary
dTemp = dValue*pow(10,nDec);
dFract = modf (dTemp, &dInt);
if (dFract >= 0.5)
dInt++;
dRes = dInt/pow(10,nDec);
//Set the needed large of the string to be placed on the screen
CString szResult;
szResult.Format ("%s%f", szResult, dRes);
int nLarge = szResult.GetLength ();
for (int i = 0; i < nLarge; i++)
{
nCount++;
CString cLetter = szResult.GetAt (i);
if (cLetter == ".")
{
nCount += nDec;
break;
}
}
//Truncate the string to be placed in the screen
LPTSTR pStr = szResult.GetBufferSetLength (nCount);
szResult.ReleaseBuffer ();
return szResult;
}
//***********
double CMyDoc::CutAndRoundNumberToNDecimals (double dValue, const int nDec)
{
double dTemp = 0, dFract = 0, dInt = 0, dRes = 0;
//Operations to round up the nth decimal number if necessary
dTemp = dValue*pow(10,nDec);
dFract = modf (dTemp, &dInt);
if (dFract >= 0.5)
dInt++;
dRes = dInt/pow(10,nDec);
return dRes;
}