SIGN()
All functions > MATH > SIGN()
Returns the sign of a number: -1 for negative, 0 for zero, 1 for positive.
Signatures
Sign
Returns: Sign indicator: -1, 0, or 1
SIGN(number: T) → BIGINT sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number | T | Yes | The number to get the sign of |
With:
T: Any numeric type
Signature notes:
- Returns -1 for negative numbers, 0 for zero, 1 for positive numbers
- Returns NULL if the input is NULL
Examples
FeatureQL
SELECT
f1 := SIGN(-10.5E0), -- Negative returns -1
f2 := SIGN(0.0E0), -- Zero returns 0
f3 := SIGN(42.7E0), -- Positive returns 1
f4 := SIGN(-5) -- Integer input
;Result
| f1 BIGINT | f2 BIGINT | f3 BIGINT | f4 BIGINT |
|---|---|---|---|
| -1 | 0 | 1 | -1 |
On this page