SIGN

All functions > MATH > SIGN

Returns the sign of a number: -1 for negative, 0 for zero, and 1 for positive.

Signatures

Returns: Sign indicator (-1, 0, or 1)

SIGN(number: T) → BIGINT
sql
ParameterTypeRequiredDescription
numberTYesThe number to get the sign of

Notes

  • Returns -1 for any negative number
  • Returns 0 for zero (positive or negative zero)
  • Returns 1 for any positive number
  • Returns NULL if the input is NULL
  • Useful for conditional logic based on number sign

Examples

FeatureQL
SELECT
    f1 := SIGN(-10.5e0),  -- Negative number returns -1
    f2 := SIGN(-1.0e0),  -- Another negative
    f3 := SIGN(0.0e0),  -- Zero returns 0
    f4 := SIGN(1.0e0),  -- Positive returns 1
    f5 := SIGN(42.7e0)  -- Another positive
;
Result
f1 BIGINTf2 BIGINTf3 BIGINTf4 BIGINTf5 BIGINT
-1-1011

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19