Function Sign(x)

Sign

Sign(
    x             ! (input) numerical expression
    )

Arguments

x

A scalar numerical expression.

Return Value

The function Sign returns \(+1\) if \(x > 0\), \(-1\) if \(x < 0\) and 0 if \(x = 0\).

Note

The function Sign can be used in constraints of nonlinear mathematical programs. However, nonlinear solver may experience convergence problems round 0.

See also

The function Abs. Arithmetic functions are discussed in full detail in Arithmetic Functions of the Language Reference.