[fpc-pascal] math round vs banker's round
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Aug 14 10:11:19 CEST 2013
On 14 Aug 2013, at 09:38, Sven Barth wrote:
> - 0.5 does not always have a direct representation as a floating point value and thus internally it might be 0.4999999 or something like that and thus it will be rounded to 0.4 (see also http://bugs.freepascal.org/view.php?id=24374 )
0.5 is one of the values that can always be represented exactly. The fractional part of IEEE 754 floating point numbers is represented as sums of negative powers of 2, i.e. 0.5, 0.25, etc.
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130814/5c98dcea/attachment.html>
More information about the fpc-pascal
mailing list