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
    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 BIGINTf2 BIGINTf3 BIGINTf4 BIGINT
-101-1

Last update at: 2026/05/26 17:22:09