I tracked down the failure of test ext/standard/tests/math/bug24142.phpt
when I tried PHP 4.4.5RC1 and found out the following: The brokenness
test in the configure script, namely
#include <math.h>
int main() {
return floor(0.045*pow(10,2) + 0.5)/10.0 != 0.5;
}
didn't work properly for me. I changed it to the following to detect the
proper PHP_ROUND_FUZZ (reducing it further changed its behaviour):
#include <math.h>
int main(int argc, char **argv) {
double value = 0.045;
value = floor(value * 100.0 + 0.5) / 100.0;
return value != 0.05;
}
Reproduction sequence:
cschneid@abflex:~/ $ cc -lm -O0 -Wall -o t t.c
cschneid@abflex:~/ $ ./t && echo OK
OK
cschneid@abflex:~/ $ cc -lm -O2 -Wall -o t t.c
cschneid@abflex:~/ $ ./t && echo OK
cschneid@abflex:~/ $
System information:
SUSE LINUX 10.0 (i586)
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
The difference doesn't exist (i.e. I guess the gcc problem was fixed) in
SUSE LINUX 10.1 / gcc version 4.1.0 (SUSE Linux).
Do you think the configure script should be changed? I'm not sure if my
version of the test works on the system where the original test was
developed.
Regards,
- Chris
Christian Schneider wrote:
Do you think the configure script should be changed? I'm not sure if my
version of the test works on the system where the original test was
developed.
https://overlays.gentoo.org/proj/php/browser/patches/php-patches/4.4.4/4.4.4/php4.4.4-gcc_inline_floor.patch
That fixes it correctly, and that same fix was later applied to the PHP5
branch, just never backported to 4_4. So, if the maintainer wants to fix
it in 4_4 too (I'd recommend and like that), here's the patch, enjoy!
--
Best regards,
Luca Longinotti aka CHTEKK
LongiTEKK Networks Admin: chtekk@longitekk.com
Gentoo Dev: chtekk@gentoo.org
SysCP Dev: chtekk@syscp.org
TILUG Supporter: chtekk@tilug.ch
Christian Schneider wrote:
Do you think the configure script should be changed? I'm not sure if my
version of the test works on the system where the original test was
developed.https://overlays.gentoo.org/proj/php/browser/patches/php-patches/4.4.4/4.4.4/php4.4.4-gcc_inline_floor.patch
That fixes it correctly, and that same fix was later applied to the PHP5
branch, just never backported to 4_4. So, if the maintainer wants to fix
it in 4_4 too (I'd recommend and like that), here's the patch, enjoy!
Thanks, I applied this one now.
regards,
Derick