Math Signum
The math::signum
function returns the sign of a number: -1 if the number is negative, 0 if it is zero, and 1 if it is positive.
Syntax
math::signum(<number>)
Parameters
number
: The input number whose sign is to be determined.
Returns
- Number:
-1
,0
, or1
indicating the sign of the input number.
Example
math::signum(-42)
This function is useful for determining the polarity of a number in mathematical or logical operations.