Sgn
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2023
- PI Server
Return an indicator of the numerical sign of a number.
Syntax
Sgn(x)
Arguments
-
x
Must be an integer or real number
Returns
-1 if x < 0; 0 if x = 0; 1 if x > 0
Exceptions
If x is not an integer or real number, returns an error value
Example
-
Sgn(1.1)
[Returns 1]
-
Sgn(0)
[Returns 0]
-
Sgn(-0.1)
[Returns -1]
-
Sgn('att1')
[Returns 1 if the value of 'att1' is positive, 0 if it equals 0, and -1 if it is negative]