History log of /php-src/ext/standard/tests/math/round_gh12143_2.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 9652889b 19-Sep-2023 Tim Düsterhus

Reimplement `php_round_helper()` using `modf()` (#12220)

This change makes the implementation much easier to understand, by explicitly
handling the various cases.

It fixes round

Reimplement `php_round_helper()` using `modf()` (#12220)

This change makes the implementation much easier to understand, by explicitly
handling the various cases.

It fixes rounding for `0.49999999999999994`, because no loss of precision
happens by adding / subtracing `0.5` before turning the result into an integral
float. Instead the fractional parts are explicitly compared.

see GH-12143 (this fixes one of the reported cases)
Closes GH-12159 which was an alternative attempt to fix the rounding issue for
`0.49999999999999994`

show more ...