> -----Original Message-----
> From: Bob Weinand [mailto:bobw...@hotmail.com]
> Sent: Monday, June 15, 2015 9:55 PM
> To: Dmitry Stogov
> Cc: da...@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 <dmi...@zend.com>:
> >
> > 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



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to