#30726 [Asn->Csd]: Negative floats <1 as strings don't work in calculations
| From: | iliaa@php.net | Date: | Tue, 18 Jan 2005 00:31:46 +0000 |
| Subject: | #30726 [Asn->Csd]: Negative floats <1 as strings don't work in calculations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72338@lists.php.net to get a copy of this message | ||
ID: 30726
Updated by: iliaa@php.net
Reported By: degusta at yahoo dot com
-Status: Assigned
+Status: Closed
Bug Type: Math related
Operating System: *
PHP Version: 4CVS, 5CVS (2005-01-10)
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-01-10 21:05:07] sniper@php.net
Assigned to Ilia per his request.
------------------------------------------------------------------------
[2005-01-10 17:00:49] sniper@php.net
See also bug #30069
This works fine with e.g. PHP 4.2.2 :)
------------------------------------------------------------------------
[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