int compareTo(num other)

Compares this to other.

Returns a negative number if this is less than other, zero if they are equal, and a positive number if this is greater than other.

The orderding represented by this method is a total ordering of num values. All distinct doubles are non-equal, as are all distinct integers, but integers are equal to doubles if they have the same numerical value.

For ordering, the double NaN value is considered equal to itself, and greater than any numeric value (unlike its behavior in operator==).

The double value -0.0 is considered less than 0.0 (and the integer 0), but greater than any non-zero negative value.

Positive infinity is greater than any finite value (any value apart from itself and NaN), and negative infinity is less than any other value.

All other values are compared using their numeric value.

Source

int compareTo(num other);