SGN Function

Standard Library function that returns the sign of passed values.

Usage

result = SGN(x)

Input Parameters

xβ€”A scalar or array.

Returned Value

resultβ€”An integer array of the same size of x where each element is:

1 where x > 0

–1 where x < 0

0 where x = 0

Keywords

None.

Examples

PM, SGN([-0.5, 0, 0.5])
; PV-WAVE prints:
;  -1
;   0
;   1