SGN
(Created page with "= <span class="f_Header">Action</span> = Returns the sign of a float value. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"> </span> ...") |
|||
Line 44: | Line 44: | ||
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> | ||
− | <span style="font- | + | <span style="font-size: 10pt;">While the SGN function can return a negative value, it can only do so for integers, longs, singles and doubles.</span> |
+ | |||
+ | When a byte, word or dword is passed, only 0 or 1 can be returned since these values do not contain a sign bit. | ||
+ | |||
+ | When a byte,word or dword is passed, the returned value is a byte. | ||
+ | |||
+ | When an integer is passed, the returned value is an integer. | ||
+ | |||
+ | When a long is passed, the returned value is a long. | ||
+ | |||
+ | When a single is passed, the returned value is a single. | ||
+ | |||
+ | When a double is passed, the returned value is a double. | ||
= <span class="f_Header">See Also</span> = | = <span class="f_Header">See Also</span> = |
Revision as of 21:26, 17 January 2017
Contents |
Action
Returns the sign of a float value.
Syntax
var = SGN( x )
Remarks
Var |
A single or double variable that is assigned with the SGNS of variable x. |
X |
The single or double to get the sign of. |
For values <0, -1 will be returned
For 0, 0 will be returned
For values >0, 1 will be returned
While the SGN function can return a negative value, it can only do so for integers, longs, singles and doubles.
When a byte, word or dword is passed, only 0 or 1 can be returned since these values do not contain a sign bit.
When a byte,word or dword is passed, the returned value is a byte.
When an integer is passed, the returned value is an integer.
When a long is passed, the returned value is a long.
When a single is passed, the returned value is a single.
When a double is passed, the returned value is a double.
See Also
Example
Dim S As Single , X As Single , Y As Single X = 2.3 : S = Sgn(x) Print S X = -2.3 : S = Sgn(x) Print S End
Languages | English • Deutsch |
---|