Commit e11721eb authored by HuangRui's avatar HuangRui
Browse files

Support floating point.

Add PRINTF_LONG_SUPPORT to %g option.
parent 2e513a96
......@@ -273,7 +273,11 @@ static int d2a(double num, char *bf)
fpart = absnum - (double)ipart;
// convert integer part to string
#ifdef PRINTF_LONG_SUPPORT
len += li2a(ipart, bf);
#else
len += i2a(ipart, bf);
#endif
#ifndef EPSILON
#define EPSILON ((double)(0.00000001))
......@@ -299,14 +303,17 @@ static int d2a(double num, char *bf)
{
fpart = fpart * 10;
}
#ifdef PRINTF_LONG_SUPPORT
len += li2a((int)fpart, bf);
#else
len += i2a((int)fpart, bf);
#endif
}
#undef EPSILON
if (num < 0)
{
len ++;
}
return len;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment