From:             nat at noworrie dot com
Operating system: FreeBSD 4.8
PHP version:      5.0.1
PHP Bug Type:     Math related
Bug description:  Float .25 as opposed to 0.25 calculates to 0

Description:
------------
Using PHP 5.0.1 as a CGI script.

10 * '.25' should be 2.5 but it equates to 0.

10 * floatval('.25') does equal 2.5.

Does not occur in PHP 5.0.0RC2.

May be a related to Bug # 29547.

Reproduce code:
---------------
$a = '.25';
$b = '0.25';
echo "10 * .25 == ".(10*$a)."\n";
echo "10 * 0.25 == ".(10*$b)."\n";


Expected result:
----------------
10 * .25 == 2.5
10 * 0.25 == 2.5


Actual result:
--------------
10 * .25 == 0
10 * 0.25 == 2.5

-- 
Edit bug report at http://bugs.php.net/?id=29921&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=29921&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29921&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29921&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=29921&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=29921&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=29921&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=29921&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=29921&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=29921&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=29921&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=29921&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=29921&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=29921&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=29921&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=29921&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=29921&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=29921&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=29921&r=float

Reply via email to