sign property

num? get sign

Negative one, zero or positive one depending on the sign and numerical value of this number.

The value minus one if this number is less than zero, plus one if this number is greater than zero, and zero if this number is equal to zero.

Returns NaN if this number is a double NaN value.

Returns a number of the same type as this number. For doubles, Obj(-0.0).sign is -0.0.

The result satisfies:

n == n.sign * n.abs()

for all numbers n (except NaN, because NaN isn't == to itself).

Implementation

num? get sign => value?.sign;