#23780 [Opn->Bgs]: Number comparision fails
| From: | derick@php.net | Date: | Fri, 23 May 2003 15:17:42 +0000 |
| Subject: | #23780 [Opn->Bgs]: Number comparision fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40290@lists.php.net to get a copy of this message | ||
ID: 23780
Updated by: derick@php.net
Reported By: walovaton at yahoo dot com dot mx
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Linux
PHP Version: 4.3.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Your sample works fine, have a look at the section in our manual about
floats. Not a bug.
Previous Comments:
------------------------------------------------------------------------
[2003-05-23 09:54:28] walovaton at yahoo dot com dot mx
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23780&edit=1