Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86672 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78779 invoked from network); 15 Jun 2015 19:55:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2015 19:55:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.175 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.175 blu004-omc4s36.hotmail.com Received: from [65.55.111.175] ([65.55.111.175:61431] helo=BLU004-OMC4S36.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/03-52527-0AD2F755 for ; Mon, 15 Jun 2015 15:55:12 -0400 Received: from BLU436-SMTP69 ([65.55.111.137]) by BLU004-OMC4S36.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Mon, 15 Jun 2015 12:55:09 -0700 X-TMN: [cvr9z66hWK6AcZSX3RKW/XCWcHvhsQev] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) In-Reply-To: Date: Mon, 15 Jun 2015 21:55:04 +0200 CC: davey@php.net, Andrea Faulds , Stanislav Malyshev , Anatol Belski , Kalle Sommer Nielsen , PHP Internals Content-Transfer-Encoding: quoted-printable References: To: Dmitry Stogov X-Mailer: Apple Mail (2.2098) X-OriginalArrivalTime: 15 Jun 2015 19:55:07.0103 (UTC) FILETIME=[2DA5D6F0:01D0A7A5] Subject: Re: [PHP-DEV] Spaceship and NaNs From: bobwei9@hotmail.com (Bob Weinand) As far as I know, we made it that way in order to enforce an int return = type all the time. int(-1) is indeed the sensible value for this. (Mainly int(0) does not = work because it'd mean equality and so we're left with int(-1) and = int(1).) Just because other comparison ops already return a bool, we can return = bool(false) there. Bob > Am 15.06.2015 um 21:44 schrieb Dmitry Stogov : >=20 > Hi, >=20 > I found a problem with spaceship operator. > It doesn't define result for comparison with NaN. >=20 > $ sapi/cli/php -r 'var_dump(sqrt(-1) <=3D> 0);' > int(-1) > $ sapi/cli/php -r 'var_dump(0 <=3D> sqrt(-1));' > int(-1) >=20 > $ sapi/cli/php -r 'var_dump(0 < sqrt(-1));' > bool(false) >=20 > all other comparison operators return "false" as well. >=20 > Thanks. Dmitry.