BitsAndPieces
Programmer
I recently found out that FloatToStrF(Value, Decplaces) sometimes makes mistakes !!
I wanted to have 23.0005 to be rounded to 3 decimal places and put into a string. And I got '23.000' !?!?
When I tried the same with 12.0005 I got '12.001' !!!
I could find out that 23.0005 was not really used by Delphi's FloatToStrF but it used 23.0004999999...99999 instead.
How can I write a function that rounds float values CORRECTLY ??
Thanks a lot
Thomas
I wanted to have 23.0005 to be rounded to 3 decimal places and put into a string. And I got '23.000' !?!?
When I tried the same with 12.0005 I got '12.001' !!!
I could find out that 23.0005 was not really used by Delphi's FloatToStrF but it used 23.0004999999...99999 instead.
How can I write a function that rounds float values CORRECTLY ??
Thanks a lot
Thomas