note 53462 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Thu, 18 Jun 2009 14:14:29 +0000 |
| Subject: | note 53462 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157086@lists.php.net to get a copy of this message | ||
Note Submitter: pandreas81 at NO dot gmx dot SPAM dot de
----
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.