Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36989 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30676 invoked from network); 12 Apr 2008 13:14:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2008 13:14:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Linux 2.6 Received: from [195.226.6.51] ([195.226.6.51:55787] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/A3-05766-3A5B0084 for ; Sat, 12 Apr 2008 09:14:12 -0400 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id CD99C16E56D; Sat, 12 Apr 2008 15:14:08 +0200 (CEST) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXFNcNYd; Sat, 12 Apr 2008 15:14:03 +0200 (CEST) Received: from box.local (84-72-92-81.dclient.hispeed.ch [84.72.92.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTP id 95B5916E589; Sat, 12 Apr 2008 15:14:03 +0200 (CEST) Message-ID: <4800B59A.3080809@cschneid.com> Date: Sat, 12 Apr 2008 15:14:02 +0200 User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: Stefan Walk CC: RQuadling@GoogleMail.com, internals@lists.php.net References: <10845a340804120340j4cca398bub5be876a8ce4ba9b@mail.gmail.com> <48009818.80307@gmail.com> In-Reply-To: <48009818.80307@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at gna.ch Subject: Re: [PHP-DEV] '1.8' == 1.8 can return false or yet another exampleof the uselessness of type juggling. From: cschneid@cschneid.com (Christian Schneider) Stefan Walk schrieb: > Richard Quadling schrieb: >> On 12/04/2008, Rasmus Lerdorf wrote: >>> There is no bug here. Please read: >>> >>> http://docs.sun.com/source/806-3568/ncg_goldberg.html >>> >>> -Rasmus >> >> So, would I be right in thinking that the only time type-juggling is >> 100% successful is between strings and integers? > > 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. 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. - Chris