Sgn: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 3: | Line 3: | ||
'''Description''' | '''Description''' | ||
SGN returns an integer indicating the sign of a number. The required parameter, number, is any valid numeric expression. If number is less than zero -1 is returned, if number is greater than zero 1 is returned, if number is equal to zero, 0 is returned. | SGN returns an integer indicating the sign of a number. The required parameter, ''number'', is any valid numeric expression. If ''number'' is less than zero -1 is returned, if ''number'' is greater than zero 1 is returned, if ''number'' is equal to zero, 0 is returned. | ||
'''Example''' | '''Example''' |
Revision as of 19:41, 8 July 2012
SGN(number)
Description
SGN returns an integer indicating the sign of a number. The required parameter, number, is any valid numeric expression. If number is less than zero -1 is returned, if number is greater than zero 1 is returned, if number is equal to zero, 0 is returned.
Example
REM SGN Example 'SGN returns the sign of a number as -1 or 1 DIM Pos, Neg, Zero Pos = SGN(44) Neg = SGN(-17) Zero = SGN(100 - 100) PRINT "Positive:", Pos PRINT "Negative:", Neg PRINT "Zero:", Zero
Output
Positive: 1 Negative: -1 Zero: 0
Related Items