Page #54

Abs(), Sign()

These two functions let you take the sign off a number.

Usage

nAbsoluteValue = ABS( nValue ) nSign = SIGN( nValue )
ABS() returns the absolute value of the number, that is, the number without the sign. SIGN() does the reverse and returns the sign without the number—it uses 1, 0 and -1 to represent positive, zero and negative signs, respectively. ABS() and SIGN() work on all four number types: currency, double, integer and numeric.

Example

? ABS(37)     && returns 37 ? ABS(-37)    && returns 37 ? SIGN(37)    && returns 1 ? SIGN(-37)   && returns -1 ? SIGN(0)     && returns 0
ABS() and SIGN() both handle null values, returning .NULL.

See Also

Int()


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net