Search…
Resources
Related Links
sign
To return the signum of a number
You can use the function to determine the sign of a number. The return value is either “1” (positive number) or “-1” (negative number). The number 0 is considered positive.

Syntax

sign(number)

Return

number

Examples

sign(x) To return the signum of number x.
sign(10 + 12)
Result: 1
sign(10 - 13)
Result: -1
sign(0)
Result: 1
sign(10.2)
Result: 1

See also

even which returns “true” if the number is even.
odd which returns “true” if the number is odd.
Last modified 2mo ago
Export as PDF
Copy link