#30726 [NEW]: Negative floats <1 as strings don't work in calculations

From: Date: Tue, 09 Nov 2004 00:10:57 +0000
Subject: #30726 [NEW]: Negative floats <1 as strings don't work in calculations
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-68822@lists.php.net to get a copy of this message
From: degusta at yahoo dot com Operating system: * PHP version: 4.3.9 PHP Bug Type: Math related Bug description: Negative floats <1 as strings don't work in calculations 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 bug report at http://bugs.php.net/?id=30726&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30726&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30726&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30726&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30726&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30726&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30726&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30726&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30726&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30726&r=support Expected behavior: http://bugs.php.net/fix.php?id=30726&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30726&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30726&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30726&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30726&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30726&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30726&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30726&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30726&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30726&r=mysqlcfg

« previous php.bugs (#68822) next »