ID:               43640
 User updated by:  tyokoo at monadel dot com dot au
 Reported By:      tyokoo at monadel dot com dot au
-Status:           Open
+Status:           Closed
 Bug Type:         Math related
 Operating System: Windows2003R2 Standard
 PHP Version:      5.2.5
 New Comment:

See FYI: http://au.php.net/float


Previous Comments:
------------------------------------------------------------------------

[2007-12-20 01:04:05] tyokoo at monadel dot com dot au

Description:
------------
If you assign 2.8 on PHP you get:
2.79999999999999982236431605997495353221893310546875

if you do:
  $n = 2.8;
  $n = $n+$n+$n+$n+$n+$n+$n+$n+$n+$n;
and compare:
  $n == 28
will be false.

2.8 is 2.8.
Nothing more or less.





Reproduce code:
---------------
$n = 2.8;
echo serialize($n).'<br />';

$n = $n+$n+$n+$n+$n+$n+$n+$n+$n+$n;

if ($n == 28) {
  echo 'right';
} else {
  echo 'wrong';
}

Expected result:
----------------
d:2.8;
right

Actual result:
--------------
d:2.79999999999999982236431605997495353221893310546875;
wrong 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43640&edit=1

Reply via email to