ID: 30726
Comment by: giorgini at interlogica dot net
Reported By: degusta at yahoo dot com
Status: Open
Bug Type: Math related
Operating System: *
PHP Version: 4.3.9
New Comment:
Using 4.3.10 and the bug holds still. Very irritating for a financial
program of ours.
Previous Comments:
------------------------------------------------------------------------
[2004-11-09 01:10:54] degusta at yahoo dot com
Description:
------------
Strings that are between 0 and -1 and don't have a leading zero, e.g.
"-.2", "-.95", etc, do not get cast to floats.
This is a variant of bug 30069 which was closed with 4.3.9. That fix
did solve the problem for positive floats (".1", ".4", etc), but
apparently not for negative floats.
The bug is still present in CVS as of 11/8/04
(php4-STABLE-200411082130). I haven't checked the 5 branch yet, but my
guess is that it's wrong there too since 30069 also existed in the 5
branch.
Every past version of PHP has cast this properly (up through and
including 4.3.8).
Reproduce code:
---------------
echo '-.1' * 2;
Expected result:
----------------
-0.2
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30726&edit=1