Visual FoxPro functions for numbers

FoxPro is a database program not a specialist package for mathematics or statistical analysis but it does provide most of the basic mathematical tools. If Visual FoxPro does not support the function you want, consider using Automation to call Excel.

Here is a list of some of the more useful commands and functions. Many of them accept extra optional parameters. Look in the FoxPro Help system for more information about their use and syntax.

Note that FoxPro syntax requires that functions are always followed by a pair of brackets - even if there's nothing in them.

<num1> % <num2> return the remainder after dividing <num1> by <num2>
<num1> ** <num2> return <num1> to the power <num2>
<num1> ^^ <num2> return <num1> to the power <num2>
ABS(<num>) return the absolute value of <num>.
ACOS(<num>) return the arc cosine of <num> as radians. Also ASIN(), ATAN() and ATN2().
CALCULATE TO (<var>) Perform calculations on a field from a table and store the result in a variable named <var>. more
CEILING(<num>) return the integer equal or greater than <num>.
COS(<num>) return the cosine of <num> radians. Also SIN() and TAN().
COUNT TO (<var>) store the number of records in a table and store the result in a variable named <var>. more
DTOR(<num>) return the equivalent of <num> radians in degrees.
EXP(<num>) return e number.
FLOOR(<num>) return the integer equal or less than <num>.
INT(<num>) return the integer part of <num>.
LOG(<num>) return the logarithm of <num> to the base e.
LOG10(<num>) return the logarithm of <num> to the base 10.
MAX(<a>, <b>, <c>, ...) return the maximum value from the list.
MIN(<a>, <b>, <c>, ...) return the minimum value from the list.
MOD(<num1>, <num2>) return the remainder after dividing <num1> by <num2>.
RAND(<num>) returns a random number between 0 and 1 using <num> as the seed for the random number generator.
ROUND(<num2>,<num2>) return <num1> rounded to <num2> decimal places.
RTOD(<num>) return the equivalent of <num> degrees in radians.
SIGN(<num>) return -1, 0 or +1 if <num> is negative, zero or positive.
SET DECIMAL TO(<num>) display numbers with <num> decimal places.
SET FIXED ON|OFF determine whether to display all numeric results with a fixed number of decimal places.
STR(<num>,<m>,<n>) return <num> as a string variable of <m> characters rounded to <n> decimal places.
SUM TO (<var>) Calculate the sum of a field from a table and store the result in a variable named (<var>). more
VAL(<text>) returns the numeric value of <text>.