Sharing with FormatFloat

2

When you try to round the decimal places to 18 decimal places by the FormatFloat function, the system generates the value 18,367 3 . How is this possible? Should not it round the value up, generating 18.367 4 ? At least at many other points on the system the FormatFloat function works as expected, but at this point this is happening ...

Anyway what I want to know is: Is this some bug ? Is it expected behavior? And, how to solve this situation?

Important details ( interesting ): If the value to be rounded changes to 18.3 8 735 the FormatFloat function rounds off the value as expected, that is to say 18,387 4 . I use Delphi XE7.

    
asked by anonymous 14.07.2017 / 20:10

1 answer

-1

This is normal behavior.

Rounding follows a metric, until 4 rounds down. From 5 round up.

It's a default, not just in Delphi.

    
15.07.2017 / 04:19