Programmer Guide/Command Reference/EVAL/sign: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
Compute the sign. | Compute the sign of the argument. | ||
;Usage: <code>sign(<var>x</var>)</code> | |||
;Usage: | |||
:;<var>x</var>: a scalar, vector or matrix | :;<var>x</var>: a scalar, vector or matrix | ||
;Result: The result ''r'' has the same type as the argument ''x''. | ;Result: The result ''r'' has the same type as the argument ''x''. | ||
::<code>''r''[''i'',''j''] is set to 1 if ''x''[''i'',''j''] | ::<code>''r''[''i'',''j''] is set to 1 if ''x''[''i'',''j'']≥0 and to -1 if ''x''[''i'',''j'']<0</code> | ||
;See also: [[ | ;See also: [[../int|int]], [[../round|round]], [[../floor|floor]] | ||
[[ | [[../#Functions|<function list>]] |
Latest revision as of 11:50, 21 April 2011
Compute the sign of the argument.
- Usage
sign(x)
- x
- a scalar, vector or matrix
- Result
- The result r has the same type as the argument x.
r[i,j] is set to 1 if x[i,j]≥0 and to -1 if x[i,j]<0