Skip to content

Sign

Returns 1.0 for positive input, -1.0 for negative input, and zero at exactly zero.

y = 1.0 when u > 0.0, y = -1.0 when u < 0.0, and y = 0.0 otherwise.

Direction Name Type
Input u T
Output y T
Name Type Default Meaning
T type (default f64) f64 Float scalar type

T defaults to f64 and is a scalar float type; comparisons are not lifted to arrays.

Input samples -3, 0, 2 produce -1, 0, 1.