|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-05-23 10:17 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 08:00:01 2025 UTC |
When I'm trying to compare two numbers, some times I get not expected results. Specially with float precision numbers. In my case: $value1 = 58.6; $value2 = 58.6; if ($value1 > $value2) { // PHP Bug! // This expresion seems to be true for some reason // The expected result is false, isn't it?? } This happens comparing the numbers as floats or as strings. It is important to say that $value1 is a value entered by the user into a form input (a validation number) and $value2 is the addition of several fields and such addition must be equal to $value1 in order to be accepted by the application. I hope this is clear enough for you. -William