sign
Return -1 for a negative number, 0 for zero and 1 for a positive number.
Try an expression
In Formula, enter the expression and set Output type to BIGINT.
Expression
sign(-349)Result
-1The expression returns TINYINT. Formula stores it as BIGINT in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.
Arguments and types
sign(x)- x
- Number
Supported signatures (12)
sign(x: BIGINT) → TINYINT
sign(x: DOUBLE) → TINYINT
sign(x: FLOAT) → TINYINT
sign(x: HUGEINT) → TINYINT
sign(x: INTEGER) → TINYINT
sign(x: SMALLINT) → TINYINT
sign(x: TINYINT) → TINYINT
sign(x: UBIGINT) → TINYINT
sign(x: UHUGEINT) → TINYINT
sign(x: UINTEGER) → TINYINT
sign(x: USMALLINT) → TINYINT
sign(x: UTINYINT) → TINYINTThe result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
If the first argument is missing, the result is NULL.
Function metadata from DuckDB, used under the MIT license.