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
ParameterTypeRequiredDescription
numberTYesThe 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
    -- Negative returns -1
    f1 := SIGN(-10.5e0),
    -- Zero returns 0
    f2 := SIGN(0.0e0),
    -- Positive returns 1
    f3 := SIGN(42.7e0),
    -- Integer input
    f4 := SIGN(-5)
;
Result
f1 BIGINTf2 BIGINTf3 BIGINTf4 BIGINT
-101-1

Last update at: 2026/06/20 10:08:10