Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52520 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53802 invoked from network); 27 May 2011 14:49:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 May 2011 14:49:00 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:40628] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/50-47900-AD9BFDD4 for ; Fri, 27 May 2011 10:48:59 -0400 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id CB83E10D1EC; Fri, 27 May 2011 15:48:54 +0100 (BST) Date: Fri, 27 May 2011 09:48:53 -0500 (CDT) X-X-Sender: derick@whisky To: Scott MacVicar cc: Philip Olson , PHP Internals In-Reply-To: <2EFE9027-13EA-4570-B6D2-2C56D85C7DAE@macvicar.net> Message-ID: References: <2EFE9027-13EA-4570-B6D2-2C56D85C7DAE@macvicar.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] INF behavior From: derick@php.net (Derick Rethans) On Thu, 26 May 2011, Scott MacVicar wrote: > On 26 May 2011, at 20:03, Philip Olson wrote: > > > Hello geeks, > > > > A geek is needed to clarify PHP bug #45712. This is an edge case but the test (bug45712.phpt) contains code similar to the following: > > > > > $inf = pow(0, -2); > > > > var_dump($inf); // float(INF) > > var_dump($inf == $inf); // bool(false) > > var_dump($inf === $inf); // bool(true) > > ?> > > > > That's how it's behaved since ~forever (AFAICT) and remains in 5.3.7-dev, but PHP 5.4.0-dev changes behavior so both now return true. > > > > Is this is how we want it? And how should this be documented/explained? > > I think I changes this :-) > > It didn't make sense that == and === produce different results. > > Though if someone has a better understanding of maths then we can fix it. I think it does make sense. == is the equal operator, and INF is not equal to INF (just like SQL NULL is not equal to NULL). However, they are identical (like you can test in SQL with NULL IS NULL). cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug