signum function (Databricks SQL)

Returns -1.0, 0.0, or 1.0 as expr is negative, 0, or positive.

Syntax

signum(expr)

Arguments

  • expr: An expression that evaluates to a numeric or interval.

Returns

A DOUBLE.

This function is a synonym for sign function (Databricks SQL).

Examples

> SELECT signum(40);
 1.0

> SELECT signum(INTERVAL'-1' DAY)
 -1.0