FloatToStrF does not round singles
Original Reporter info from Mantis: BeniBela @benibela
-
Reporter name: Benito van der Zander
Original Reporter info from Mantis: BeniBela @benibela
- Reporter name: Benito van der Zander
Description:
FloatToStrF sees to ignore the precision option with singles.
Steps to reproduce:
var
s: single;
begin
s := 1.00999;
writeln(FloatToStrF(s, ffGeneral, 8, 0, FormatSettings));
writeln(FloatToStrF(s, ffGeneral, 7, 0, FormatSettings));
writeln(FloatToStrF(s, ffGeneral, 6, 0, FormatSettings));
writeln(FloatToStrF(s, ffGeneral, 5, 0, FormatSettings));
writeln(FloatToStrF(s, ffGeneral, 4, 0, FormatSettings));
writeln(FloatToStrF(s, ffGeneral, 3, 0, FormatSettings));
writeln(FloatToStrF(s, ffGeneral, 2, 0, FormatSettings));
end
prints
1.009989977
1.009989977
1.009989977
1.009989977
1.009989977
1.009989977
1.009989977
Additional information:
On 2.6.2 it prints correctly rounded results:
1.00999
1.00999
1.00999
1.01
1.01
1.01
1
Mantis conversion info:
- Mantis ID: 24131
- Build: 2.7.1 [2013/03/23] for x86_64
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 24013 (#7dfe1301)