]> granicus.if.org Git - php/commit
Fixed bug #42294 (Unified solution for round() based on C99 round)
authorIlia Alshanetsky <iliaa@php.net>
Wed, 29 Oct 2008 20:03:34 +0000 (20:03 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 29 Oct 2008 20:03:34 +0000 (20:03 +0000)
commit22f3c8b05bf1333c04e9eb1a57c27cc660c678b5
tree755f578aa582c3d8e52adc2e151efb4166c5cfc9
parentb9c03aa4a58820ac0c917ae247553d58e90672d9
Fixed bug #42294 (Unified solution for round() based on C99 round)
[DOC] New implementation of round() to work-around inconsistencies for win32
and 64 bit platforms.

This solution is very roughly based on BSD's implmentation of round(), which
itself is an implementation of C99 standard. We take the absolute value of number
we want to round time the 10 to the power of the number of decimal spaces we are
rounding to. The resulting value is rounded up and the pre-rounded value is
subtracted from it. If the difference is greater then 0.5000000001 we round up,
otherwise we round down.
ext/standard/math.c