Edit report at http://bugs.php.net/bug.php?id=51396&edit=1
ID: 51396
Updated by: pajoye@php.net
Reported by: codeslinger at compsalot dot com
Summary: Math is Unreliable
Status: Bogus
Type: Bug
Package: Math related
Operating System: any
PHP Version: Irrelevant
New Comment:
Please read my last comment and provide the info I asked there. Without
that, there is not a chance to get anywhere regarding this issue.
Previous Comments:
------------------------------------------------------------------------
[2010-05-24 13:46:10] codeslinger at compsalot dot com
In Summary: As Reported by Multiple People
Windows XP (32 bit) PHP 5.2.4 Fails
Windows XP (32 bit) PHP 5.2.5 Works
Windows 2000 (32 bit) PHP 5.2.5 Works
Windows XP (32 bit) PHP 5.2.9 Fails
Windows 2000 (32 bit) PHP 5.2.9 Fails
Windows 2000 (32 bit) PHP 5.2.11 Fails
Windows 2003 (?? bit) PHP 5.2.12 Fails
Windows 2003 (?? bit) PHP 5.2.13 Fails
Ubuntu 8 (32bit) PHP 5.2.4 Fails
Ubuntu 8 (32bit) PHP 5.2.9 (custom build) Works
Ubuntu 9 (64bit) PHP 5.2.10 Works
Mandriva 2008 (32bit & 64bit) PHP 5.2.4 Works
Mandriva 2008 (32bit & 64bit) Unpatched PHP 5.2.5 Fails
This bug has been reported by multiple people. The above list is the
combination of my own testing plus what I found reported by other
people. The windows oses are all using the STOCK BUILD as provided by
php.net
It is very important to understand that the specific values which fail
are highly variable. A specific value which fails on one os/php version
does not necessarily fail on a different combination of os+php, but a
different value will fail instead.
It is also important to realize that given the obscurity and variability
of this bug, just because a particular version of php is reported as
working, does not guarantee that the bug does not exist, it only says
that so far no one has reported encountering a specific value which
triggers this bug.
All of the following are thought to influence the specific behavior and
reproducibility of this bug.
The number of cpu bits
The operating system
The specific version of php
The compiler flags that were used to build php
The "precision" setting for php
The format specifier/precision in an sprintf statement
sprintf versus implied (string) conversion
It is also possible that the floating point hardware could have an
influence on the reproducibility of this bug.
Since the WORK-AROUND did not work for John, it would appear that we
still have a problem which needs to be solved.
------------------------------------------------------------------------
[2010-05-24 03:17:36] john dot smith dot 1964 at gmail dot com
This problem isn't fixed for us by adding "ini_set("precision", 16);".
Our PHP
install is stock off the website (5.2.4 and 5.2.13, for instance) and
our box runs
Windows 2003.
------------------------------------------------------------------------
[2010-05-24 02:18:46] pajoye@php.net
.
------------------------------------------------------------------------
[2010-05-24 02:04:27] codeslinger at compsalot dot com
Yipee!!! at least I have finally found a work-around that I can live
with!!!
You can close this bug now.
The Mandriva Devs seem to think that this is actually a GCC bug and that
it is Dependant on the build flags used. You can read about it here.
https://qa.mandriva.com/show_bug.cgi?id=37171
Thanks to John (above) for the link.
A lot more reading/searching of this WELL KNOWN ISSUE finally lead me
to here:
http://www.mysqlperformanceblog.com/2008/01/10/php-vs-bigint-vs-float-conversion-caveat/
and here:
http://www.farad.com.au/source_code/php/setting_floating_point_precision_src.php
To cut to the chase, the actual work-around is to change the
"precision". This solution was hinted at by my simplefail.php program
(test option 20), but I was unaware of an ini setting that is available
for this.
The solution to all of this madness and it is very mad indeed... is to
add the following in your php program.
ini_set("precision", 16);
End of Problem.... End of Bug...
Like Good Day Eh?
------------------------------------------------------------------------
[2010-05-23 14:42:13] pajoye@php.net
There is no need to write a novel about this possible issue.
Please ask the Mandriva guys to actually report a bug here (in this
report for example), post their patch(es), a reproduce script with a
description of their architecture (compiler, compiler versions, OS,
etc.).
Everything else are unnecessary information.
Now, what Johannes said is still valid:
- we don't support custom version of PHP (aka patched)
- that includes suhoshin patch
- Debugger/optimizer (zend, xdebug, etc.) has to be removed to reproduce
a problem.
Thanks for your feedback.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=51396
--
Edit this bug report at http://bugs.php.net/bug.php?id=51396&edit=1