|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-12-20 02:11 UTC] tyokoo at monadel dot com dot au
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 08:00:01 2025 UTC |
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