Back to Math
sign
Sign of a value (-1, 0, or 1).
Syntax
sign(x) → -1 if x < 0, 0 if x == 0, 1 if x > 0
Backends
TypeScript
Description
Sign of a value (-1, 0, or 1).
Parameters
| Name | Description |
|---|---|
| x | Input value |
Returns
-1 if x < 0, 0 if x == 0, 1 if x > 0