FormatFloat broken for exponential format and value 0
Original Reporter info from Mantis: wp @wpam
-
Reporter name:
Original Reporter info from Mantis: wp @wpam
- Reporter name:
Description:
The output of FormatFloat('0.0E+0', 0) is malformed in FPC 3.2.0 and trunk.
Steps to reproduce:
Run this program:
program Project1;
uses
SysUtils;
begin
WriteLn(FormatFloat('0.0E+00', 0)); // Output: '0.0E--1' --> "ugly"
WriteLn(FormatFloat('0.0E-00', 0)); // Output: '0.0E--1' --> "ugly"
WriteLn(FormatFloat('0.0E00', 0)); // Output: '0.0E0' ---> correct
WriteLn;
WriteLn(FormatFloat('0.0E+0', 0)); // Output: '0.0E--1' --> "ugly"
WriteLn(FormatFloat('0.0E-0', 0)); // Output: '0.0E--1' --> "ugyl"
WriteLn(FormatFloat('0.0E0', 0)); // Output: '0.0E0' ---> correct
ReadLn;
end.
The output is indicated in the comments. In the lines marked as "ugly" I'd expect the output to be '0.0E+00' or '0.0E+0'.
Older versions of FPC (3.0.4) produce the expected output.