[fpc-devel] FormatFloat
darekm at emadar.com
darekm at emadar.com
Wed Dec 30 23:37:14 CET 2009
>
> On 30 Dec 2009, at 16:20, darekm at emadar.com wrote:
>
>> I try to resolve http://bugs.freepascal.org/view.php?id=15308
>> problem is with str
>> str(1.0:10,s); writeln(s);
>> str(1.05:10,s);writeln(s);
>> str(1.05e2,s);writeln(s);
>> give results (:
>>
>> 1.000E+00
>> 1.0E+0000
>> 1.050000000000000E+0002
>> ^^// moving
>>
>> where I can find implementation of str
>
> str_real in rtl/inc/real2str.inc. Make sure to do a test suite run after
> changing anything in that code, because there are a lot of things that can
> go wrong there (and which have gone wrong in the past).
>
There is patch. Problem is only with numbers when correction of rounding
is made and only when exponent is shown.
to test case these numbers should be added
str(0.99999999999e2:7,s);
str(0.99999999999e8:7,s);
str(1.0499999999999e2:10,s);
if someone help me I can modify test case.
Index: real2str.inc
===================================================================
--- real2str.inc (wersja 14500)
+++ real2str.inc (kopia robocza)
@@ -381,12 +381,6 @@
d := frac(d);
if (f < 0) then
begin
- dec(currprec);
- if (currprec=0) then
- begin
- inc(spos);
- temp[spos]:='0';
- end;
end;
end;
{ calculate the necessary fractional digits }
Darek
More information about the fpc-devel
mailing list