Bug #52324 [Opn->Bgs]: bad result when adding two floats
Edit report at http://bugs.php.net/bug.php?id=52324&edit=1
ID: 52324
Updated by: rasmus@php.net
Reported by: brunog at micro-examples dot com
Summary: bad result when adding two floats
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: ubuntu
PHP Version: 5.2.14RC2
New Comment:
prints 0.1 for me. You are probably hitting a floating point limitation
combined
with a precision setting problem in your environment. Try adding
ini_set('precision',16); to the top of your script and you will see.
Previous Comments:
------------------------------------------------------------------------
[2010-07-13 00:35:04] brunog at micro-examples dot com
Description:
------------
PHP Version => 5.2.4-2ubuntu5.10
can you please consider this short code ?
Test script:
---------------
<?php
$f1 = 0.09 ;
$f2 = 0.01 ;
$tot = $f1 + $f2 ;
echo("$tot\n") ;
?>
Expected result:
----------------
0.1
Actual result:
--------------
0.0:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52324&edit=1
Thread (9 messages)