Sgn: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
SGN(<X>) | |||
The '''Sgn''' [[internal function]] returns a value which identifies whether a numeric value is negative, positive or zero. The returned values are as follows: | The '''Sgn''' [[internal function]] returns a value which identifies whether a numeric value is negative, positive or zero. The returned values are as follows: | ||
-1 if X is negative | -1 if X is negative | ||
SGN is affected by the value of the [[BRConfig.sys]] [[RD]] specification. For instance, if RD were set to 6 (the default), the value returned by the following SGN function would be 1 (positive). But if RD were set to 3, the returned value would be 0 | 0 if X is zero | ||
1 if X is positve | |||
====Example==== | |||
00010 print SGN(-3) | |||
00020 print SGN(0) | |||
00030 print SGN(6.5) | |||
Output: | |||
-1 | |||
0 | |||
1 | |||
SGN is affected by the value of the [[BRConfig.sys]] [[RD]] specification. For instance, if RD were set to 6 (the default), the value returned by the following SGN function would be 1 (positive). But if RD were set to 3, the returned value would be 0. | |||
<noinclude> | <noinclude> | ||
[[Category:Internal Functions]] | [[Category:Internal Functions]] | ||
</noinclude> | </noinclude> |
Latest revision as of 03:09, 22 May 2014
SGN(<X>)
The Sgn internal function returns a value which identifies whether a numeric value is negative, positive or zero. The returned values are as follows:
-1 if X is negative
0 if X is zero
1 if X is positve
Example
00010 print SGN(-3) 00020 print SGN(0) 00030 print SGN(6.5)
Output:
-1 0 1
SGN is affected by the value of the BRConfig.sys RD specification. For instance, if RD were set to 6 (the default), the value returned by the following SGN function would be 1 (positive). But if RD were set to 3, the returned value would be 0.