ID: 39097
Updated by: [EMAIL PROTECTED]
Reported By: phpbugrep-20061009 at pgregg dot com
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: FreeBSD
PHP Version: 5.2.0RC5
New Comment:
The constants are system dependent.
If your system doesn't define them, PHP should do so.
The goal of the test is to make sure they are defined, not
their value.
Previous Comments:
------------------------------------------------------------------------
[2006-10-09 15:45:21] phpbugrep-20061009 at pgregg dot com
Sorry "Description" should say: Running make test on 5.2.0RC5 fails
with
------------------------------------------------------------------------
[2006-10-09 15:43:56] phpbugrep-20061009 at pgregg dot com
Description:
------------
Running make test on 5.2.0RC4 fails with:
FAIL Math constants [ext/standard/tests/math/constants.phpt]
Reproduce code:
---------------
Add this additional debug to run-tests.php at line 1494:
$output_pgarr = explode("\n", $output);
$wanted_pgarr = explode("\n", $wanted);
foreach($wanted_pgarr as $line) {
list($pgleft, $pgright) = explode(":", $line, 2);
$pgleft = trim($pgleft); $pgright = trim($pgright);
$pgwanted[$pgleft] = "$pgright";
}
foreach($output_pgarr as $line) {
list($pgleft, $pgright) = explode(":", $line, 2);
$pgleft = trim($pgleft); $pgright = trim($pgright);
if (strcmp($pgright, $pgwanted[$pgleft]) !== 0)
printf("%-10s: Expected: %-16s Got: %-16s Diff: %s\n", $pgleft,
$pgwanted[$pgleft], $pgright, bcsub($pgwant
ed[$pgleft], $pgright,12));
}
% echo "ext/standard/tests/math/constants.phpt" > pgtest.txt
% php run-tests.php -l pgtest.txt
Expected result:
----------------
Expected test to PASS
Actual result:
--------------
Added more code to run-tests.php to report on what was going on and
got:
M_E : Expected: 2.718281828459 Got: 2.71828182846 Diff:
-0.000000000001
M_LOG2E : Expected: 1.442695040889 Got: 1.44269504089 Diff:
-0.000000000001
M_LN2 : Expected: 0.693147180559 Got: 0.69314718056 Diff:
-0.000000000001
M_LN10 : Expected: 2.302585092994 Got: 2.30258509299 Diff:
0.000000000004
M_PI : Expected: 3.141592653589 Got: 3.14159265359 Diff:
-0.000000000001
M_PI_2 : Expected: 1.570796326794 Got: 1.57079632679 Diff:
0.000000000004
M_1_PI : Expected: 0.318309886183 Got: 0.318309886184 Diff:
-0.000000000001
M_2_PI : Expected: 0.636619772367 Got: 0.636619772368 Diff:
-0.000000000001
M_SQRTPI : Expected: 1.772453850905 Got: 1.77245385091 Diff:
-0.000000000005
M_2_SQRTPI: Expected: 1.128379167095 Got: 1.1283791671 Diff:
-0.000000000005
M_LNPI : Expected: 1.144729885849 Got: 1.14472988585 Diff:
-0.000000000001
M_EULER : Expected: 0.577215664901 Got: 0.577215664902 Diff:
-0.000000000001
M_SQRT2 : Expected: 1.414213562373 Got: 1.41421356237 Diff:
0.000000000003
M_SQRT1_2 : Expected: 0.707106781186 Got: 0.707106781187 Diff:
-0.000000000001
M_SQRT3 : Expected: 1.732050807568 Got: 1.73205080757 Diff:
-0.000000000002
FAIL Math constants [ext/standard/tests/math/constants.phpt]
As you can see, we have lost a decimal place of precision.
plop:root/p2-/usr/local/src/Web/Apache2_PHP5/php-5.2.0RC5-862#->uname
-a 4:38PM
FreeBSD plop.pgregg.com 5.5-PRERELEASE FreeBSD 5.5-PRERELEASE #4: Tue
Mar 7 13:49:31 GMT 2006
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/PGREGG_PLOP i386
This test passed ok in 5.2.0RC4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39097&edit=1