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