#29921 [Opn->Bgs]: Float .25 as opposed to 0.25 calculates to 0
| From: | derick@php.net | Date: | Tue, 31 Aug 2004 17:10:07 +0000 |
| Subject: | #29921 [Opn->Bgs]: Float .25 as opposed to 0.25 calculates to 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65533@lists.php.net to get a copy of this message | ||
ID: 29921
Updated by: derick@php.net
Reported By: nat at noworrie dot com
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: FreeBSD 4.8
PHP Version: 5.0.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2004-08-31 18:33:52] nat at noworrie dot com
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 this bug report at http://bugs.php.net/?id=29921&edit=1