Nicer formatting of '.0'
git-svn-id: http://picoc.googlecode.com/svn/trunk@287 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
758955fc11
commit
eac072593c
12
clibrary.c
12
clibrary.c
|
@ -106,9 +106,15 @@ void PrintFP(double Num, struct OutputStream *Stream)
|
||||||
Num /= pow(10.0, Exponent);
|
Num /= pow(10.0, Exponent);
|
||||||
PrintInt((int)Num, Stream);
|
PrintInt((int)Num, Stream);
|
||||||
PrintCh('.', Stream);
|
PrintCh('.', Stream);
|
||||||
for (Num = (Num - (int)Num) * 10; abs(Num) >= 1e-7; Num = (Num - (int)(Num + 1e-7)) * 10)
|
Num = (Num - (int)Num) * 10;
|
||||||
PrintCh('0' + (int)(Num + 1e-7), Stream);
|
if (abs(Num) >= 1e-7)
|
||||||
|
{
|
||||||
|
for (; abs(Num) >= 1e-7; Num = (Num - (int)(Num + 1e-7)) * 10)
|
||||||
|
PrintCh('0' + (int)(Num + 1e-7), Stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PrintCh('0', Stream);
|
||||||
|
|
||||||
if (Exponent != 0)
|
if (Exponent != 0)
|
||||||
{
|
{
|
||||||
PrintCh('e', Stream);
|
PrintCh('e', Stream);
|
||||||
|
|
Loading…
Reference in a new issue