note 53462 added to language.operators.comparison
| From: | pandreas81 at NO dot gmx dot SPAM dot de | Date: | Thu, 02 Jun 2005 10:40:34 +0000 |
| Subject: | note 53462 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89784@lists.php.net to get a copy of this message | ||
Please note that the example in some notes before is not 100% correct, because it misses the call of
abs().
To compare a float you should use abs($myFloat - 0.3) < EPSILON. This way of comparison is very
common in other languages and it's cleaner than converting the values to strings. I suggest
using a constant instead of a variable for EPSILON.
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53462
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53462&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53462&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53462&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53462&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53462&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53462&report=yes
Search -- http://master.php.net/manage/user-notes.php