note 118443 deleted from migration70.new-features by salathe
| From: | salathe@php.net | Date: | Mon, 07 Dec 2015 11:05:40 +0000 |
| Subject: | note 118443 deleted from migration70.new-features by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204298@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
The key difference between the spaceship operator and the sign function is that the sign function
returns the sign of a single value or expression, while the spaceship <=> returns, in a single
operation, the results of the <, <=, ==, !=, >= and > operators aplied to the same pair
of values or expressions. It also differ from sgn(a - b) in that it doesn't require the
subtraction to be valid, in range or well defined. For example (largestnum <=> -largestnum)
is valid while sgn(largestnum - (-largestnum)) involves a numeric overflow in the subtraction.