From: phpbugrep-20061009 at pgregg dot com
Operating system: FreeBSD
PHP version: 5.2.0RC5
PHP Bug Type: Math related
Bug description: Decimal order of magnitude of precision lost between 5.2.0RC4
and RC5
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 bug report at http://bugs.php.net/?id=39097&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39097&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39097&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39097&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39097&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39097&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39097&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39097&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39097&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39097&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39097&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39097&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39097&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39097&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39097&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39097&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39097&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39097&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39097&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39097&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39097&r=mysqlcfg