[PATCH] rounding fuzz fix for recent gcc

From: Date: Tue, 31 Aug 2004 09:34:25 +0000
Subject: [PATCH] rounding fuzz fix for recent gcc
Groups: php.internals 
Request: Send a blank email to internals+get-12498@lists.php.net to get a copy of this message
gcc 3.4.x on x86 optimises the configure test for whether rounding "fuzz" is needed such that the test result flips from true to false, unlike previous gcc releases. The bug24142.t tests for PHP round() then fails, so I presume this is a real problem. Out-of-line-ing the code a little works around this by preventing an inline floor() from being used. --- 4.3/ext/standard/config.m4 10 May 2004 07:25:11 -0000 1.47.2.14 +++ 4.3/ext/standard/config.m4 19 Aug 2004 13:55:54 -0000 @@ -234,8 +234,11 @@ AC_MSG_CHECKING([whether rounding works as expected]) AC_TRY_RUN([ #include <math.h> + double my_floor(double n) { + return floor(n*pow(10,2) + 0.5); + } int main() { - return floor(0.045*pow(10,2) + 0.5)/10.0 != 0.5; + return my_floor(0.045)/10.0 != 0.5; } ],[ PHP_ROUND_FUZZ=0.5

« previous php.internals (#12498) next »