Spaceship and NaNs
| From: | Dmitry Stogov | Date: | Mon, 15 Jun 2015 19:44:46 +0000 |
| Subject: | Spaceship and NaNs | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-86670@lists.php.net to get a copy of this message | ||
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.
Thanks. Dmitry.