Reference Guide > S Routines > SGN Function
  

SGN Function
Standard Library function that returns the sign of passed values.
Usage
result = SGN(x)
Input Parameters
xA 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

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.