Re: '1.8' == 1.8 can return false or yet another exampleof the uselessness of type juggling.
| From: | Christian Schneider | Date: | Sat, 12 Apr 2008 13:14:02 +0000 |
| Subject: | Re: '1.8' == 1.8 can return false or yet another exampleof the uselessness of type juggling. | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36989@lists.php.net to get a copy of this message | ||
Stefan Walk schrieb:
Richard Quadling schrieb:For those curious about an example of this effect: $a = 1.00001 + 0.79999; $b = 1.8; var_dump($a, $b, $a === $b); => float(1.8) float(1.8) bool(true) $a = 1.000001 + 0.799999; $b = 1.8; var_dump($a, $b, $a === $b); => float(1.8) float(1.8) bool(false) on my machine here. - ChrisOn 12/04/2008, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:I suggest you read the page that Rasmus referred to. The effect has nothing to do with type conversions, it happens with pure float computations too.There is no bug here. Please read: http://docs.sun.com/source/806-3568/ncg_goldberg.html -RasmusSo, would I be right in thinking that the only time type-juggling is 100% successful is between strings and integers?