Hi,
In order to cope with the negative numbers,
an even shorter alternative could be to divide num by abs(num).
That gives 1 or -1 as needed.
Paul
In order to cope with the negative numbers,
an even shorter alternative could be to divide num by abs(num).
That gives 1 or -1 as needed.
Paul