Link Search Menu Expand Document

sign

Explanation Determines the sign of a number.
Call format var s = sign( arg )
Return value The sign is judged and the following values ​​are returned.

-1: Numerical value is negative
0: The number is zero
1: Numerical value is a positive number
Arguments Number arg Numerical value to judge the sign
Exception None
Example of use
var a;
a = sign(2);  /* aは1となる */
a = sign(-1); /* aは-1となる */
a = sign(0);  /* aは0となる */
Related item abs method