Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86673 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81568 invoked from network); 15 Jun 2015 20:12:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2015 20:12:04 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:46645] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/00-15639-2913F755 for ; Mon, 15 Jun 2015 16:12:02 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id 011D823D629F; Mon, 15 Jun 2015 22:11:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on h1123647.serverkompetenz.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.5 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable version=3.3.2 Received: from w530phpdev (pD9FD2BF6.dip0.t-ipconnect.de [217.253.43.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id A9E5123D615B; Mon, 15 Jun 2015 22:11:55 +0200 (CEST) To: "'Bob Weinand'" , "'Dmitry Stogov'" Cc: , "'Andrea Faulds'" , "'Stanislav Malyshev'" , "'Anatol Belski'" , "'Kalle Sommer Nielsen'" , "'PHP Internals'" References: In-Reply-To: Date: Mon, 15 Jun 2015 22:11:54 +0200 Message-ID: <019401d0a7a7$888cf2e0$99a6d8a0$@belski.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQHuMUuXa0mML7WyHRI7ljOae3OhywJllLr4nV++8HA= Content-Language: en-us Subject: RE: [PHP-DEV] Spaceship and NaNs From: anatol.php@belski.net ("Anatol Belski") > -----Original Message----- > From: Bob Weinand [mailto:bobwei9@hotmail.com] > Sent: Monday, June 15, 2015 9:55 PM > To: Dmitry Stogov > Cc: davey@php.net; Andrea Faulds; Stanislav Malyshev; Anatol Belski; Kalle > Sommer Nielsen; PHP Internals > Subject: Re: [PHP-DEV] Spaceship and NaNs > > 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 : > > > > Hi, > > > > I found a problem with spaceship operator. > > It doesn't define result for comparison with NaN. > > > > $ sapi/cli/php -r 'var_dump(sqrt(-1) <=> 0);' > > int(-1) > > $ sapi/cli/php -r 'var_dump(0 <=> sqrt(-1));' > > int(-1) > > > > $ sapi/cli/php -r 'var_dump(0 < sqrt(-1));' > > bool(false) > > > > all other comparison operators return "false" as well. > > false were correct, IMHO. Btw looks like the same case is with NAN <=> NAN. Regards Anatol