Sign Helper Function

pfurth
Community Member

I'm an instructor.

I would like a sign() helper function.  It returns +1 if number is positive, -1 if number is negative and 0 if number is 0.

The formula x/abs(x) works pretty good, except if x = 0.

0 Likes