Sign
Returns 1.0 for positive input, -1.0 for negative input, and zero at exactly zero.
Behavior
Section titled “Behavior”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 |
Parameters
Section titled “Parameters”| 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.
Example
Section titled “Example”Input samples -3, 0, 2 produce -1, 0, 1.