Operator <=> does not seem to return the difference between the two values

According to the documentation (https://electricimp.com/docs/squirrel/squirrelcrib/): Squirrel also provides a three-way comparison operator, <=>, which compares two values and returns a third according the result of that comparison, specifically the difference between the first and second values:

When I used it to compare integers (date and time from Arduino to Imp Clock Time)(hour to hour, month to month, etc.) the operator returned -1 or 0 (presumably 1, also…) but not the magnitude of the difference. There was an Imp update yesterday.

That documentation isn’t right: <=> has only ever returned the sign of the difference (-1, 0 or 1), not the magnitude. This didn’t change yesterday.

To get the magnitude of the difference, use math.abs(a-b).


I wasn’t meaning to suggest that the change occurred yesterday, just that there is difference in the documentation and the operator function.