private string FormatGeneral (int precision, NumberFormatInfo nfi)
{
bool enableExp;
if (precision == -1) {
enableExp = IsFloatingSource;
precision = _defPrecision;
}
else {
enableExp = true;
if (precision == 0)
precision = _defPrecision;
RoundPos (precision);
}
int intDigits = _decPointPos;
int digits = _digitsLen;
int decDigits = digits - intDigits;
if ((intDigits > precision || intDigits <= -4) && enableExp)
return FormatExponential (digits - 1, nfi, 2);
if (decDigits < 0)
decDigits = 0;
if (intDigits < 0)
intDigits = 0;
ResetCharBuf (decDigits + intDigits + 3);
if (!_positive)
Append (nfi.NegativeSign);
if (intDigits == 0)
Append ('0');
else
AppendDigits (digits - intDigits, digits);
if (decDigits > 0) {
Append (nfi.NumberDecimalSeparator);
AppendDigits (0, decDigits);
}
return new string (_cbuf, 0, _ind);
}