Math Functions

Functions included in this section are listed below. Click a link to jump to that function.

Numeric (Arithmetic Operators)
ABS( ) Function

ACOS( ) Function

ASIN( ) Function

ATAN( ) Function

ATN2( ) Function

AVG( ) Function

BINTOC( ) Function

BITAND( ) Function

BITCLEAR( ) Function

BITLSHIFT( ) Function

BITOR( ) Function

BITRSHIFT( ) Function

BITSET( ) Function

BITTEST( ) Function

BITXOR( ) Function

CEILING( ) Function

COS( ) Function

COUNT( ) Function

DTOR( ) Function

EXP( ) Function

FLOOR( ) Function

FV( ) Function

INT( ) Function

LOG( ) Function

LOG10( ) Function

MAX( ) Function

MIN( ) Function

MOD( ) Function

MTON( ) Function

NTOM( ) Function

PAYMENT( ) Function

PI( ) Function

PV( ) Function

RAND( ) Function

RECCOUNT( ) Function

RECNO( ) Function

ROUND( ) Function

RTOD( ) Function

SIGN( ) Function

SIN( ) Function

SQRT( ) Function

SUM( ) Function

TAN( ) Function

VAL( ) Function

Numeric (Arithmetic Operators)

  1. Exponentiation
  2. Unary -/+
  3. Exponentiation
  4. Modulus
  5. Multiplication and division
  6. Addition, subtraction, and string concatenation
  7. Relational operators (=, <, >, et.)
  8. Unary .NOT.
  9. Logical operators (.AND. and .OR.)

ABS( ) Function

Purpose Returns the absolute value of the specified numeric expression
Syntax ABS(<expN>)
Returns Numeric
Parameter <expN> is the numeric expression whose absolute value is returned by ABS( )
Examples
ABS(-45) Returns: 45
ABS(10-30) Returns: 20
ABS(30-10) Returns: 20
ABS(prem) Returns premiums as positive amounts.

ACOS( ) Function

Purpose This trigonometric function returns the arc cosine in radians.
Syntax ACOS(<expN>)
Returns Numeric
Parameter <expN>  The arc cosine of <expN> is returned by ACOS( ). The value of <expN> can range from +1 through -1. The value returned by ACOS( ) ranges from 0 through pi ( 3.141592). The number of decimal places ACOS( ) returns is determined by SET DECIMALS.

Use RTOD( ) to convert radians to degrees.

Examples
ACOS(0) Returns: 1.57
RTOD(ACOS(0)) Returns: 90

ASIN( ) Function

Purpose This trigonometric function returns in radians the arc sine of the numeric expression <expN>
Syntax ASIN(<expN>)
Returns Numeric
Parameters <expN>  The value of <expN> can range from +1 through -1, and the value returned by ASIN( ) can range from -pi/2 through +pi/2 ( -1.57079 to 1.57079). The number of decimal places in the display of the result can be specified with SET DECIMALS.

Use RTOD( ) to convert radians to degrees.

Example
ASIN(0.9) Returns: 1.12
RTOD(ASIN(1)) Returns: 90

ATAN( ) Function

Purpose This trigonometric function returns in radians the arc tangent of a numeric expression.
Syntax ATAN(<expN>)
Returns Numeric
Parameter <expN>   ATAN( ) returns the arc tangent of the numeric expression <expN>. <expN> can be any value; the value returned by ATAN( ) can range from -pi/2 through +pi/2 ( -1.57079 to 1.57079). The number of decimal places displayed in the value returned by ATAN( ) is determined by SET DECIMALS.

The numeric value returned by ATAN( ) is in radians. Use RTOD( ) to convert this value to degrees.

Examples
ATAN(PI()/2 Returns: 1.00
RTOD(ATAN(1)) Returns: 45

ATN2( ) Function

Purpose This trigonometric function returns the arc tangent angle in all four quadrants from specified sine and cosine values.
Syntax ATN2(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1> The coordinate y

<expN2> The   coordinate x

The value of <expN1>/<expN2> must be between -pi and +pi.

The value returned by ATN2( ) can be converted to degrees with RTOD( ). The number of decimal places in the display of the result can be specified with SET DECIMALS.

Remarks In ATN2( ) you specify a set of x and y coordinates. In ATAN( ) you specify a tangent value.
Example
ATN2(0,-1) Returns: 3.14
RTOD(ATN2(1,1) Returns: 45

AVG( ) Function

Purpose Computes the arithmetic mean of <expN>.
Syntax AVG(<expN>)
Returns Numeric
Parameters <expN>
Remarks The <expN> in AVG( ) may be a number, or a numeric expression, memory variable, or a field.
Example
AVG(prem) Returns the average premium for the records selected.

BINTOC( ) Function

Purpose Converts an integer value to a binary character representation.
Syntax BINTOC(<expN1> [, <expN2>])
Returns Character
Parameters <expN1> Specifies the integer value to convert.

<expN2> Specifies the length in characters of the returned character string.

<expN2> also determines the value you can specify for <expN1>. The following table lists the permissible values for <expN2> and the corresponding range of values for <expN2>.

<expN2> <expN1> Range
1 –128 to 127
2 –32,768 to 32,767
4 (default) –2,147,483,648 to 2,147,483,647

If <expN2> is omitted, BINTOC() returns a character string composed of four characters.

Remarks BINTOC() lets you convert the value in the numeric field to a single character representation.
Example
BINTOC(-90,1) Returns: &

BITAND( ) Function

Purpose Returns the result of a bitwise AND operation performed on two numeric values.
Syntax BITAND(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1>, <expN2> Specifies the numeric values on which the bitwise AND operation is performed. If <expN1> and <expN2> are not integers, they are converted to integers before the bitwise AND operation is performed.
Remarks

BITAND() compares each bit in <expN1> to the corresponding bit in <expN2>. If the bits in <expN1> and <expN2> are both 1, the corresponding result bit is set to 1; otherwise, the corresponding result bit is set to 0. The following table shows the result of a bitwise AND operation on corresponding <expN1> and <expN2> bits.

<expN1> bit <expN2> bit Resulting bit
0 0 0
0 1 0
1 1 1
1 0 0
Example
BITAND(3,6) 3 = 0011 binary, 6 = 0110 binary

 

Returns: 2  0010 binary

BITCLEAR( ) Function

Purpose Clears a specified bit (sets it to 0) in a numeric value and returns the resulting value.
Syntax BITCLEAR(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1> Specifies the numeric value in which a bit is cleared. If <expN1> is not an integer, it is converted to an integer before its bit is set.

<expN2> Specifies the bit position in <expN1> that is cleared. <expN2> can range from 0 to 31; 0 is the rightmost bit.

Example
BITCLEAR(7,1) 7 = 0111 binary, 1 to clear the second bit

 

Returns: 5 0101 binary

BITLSHIFT( ) Function

Purpose Returns the result of shifting the bits of a numeric value to the left a specified number of positions.
Syntax BITLSHIFT(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1> Specifies the numeric value whose bits are shifted to the left. If <expN1> is not an integer, it is converted to an integer before its bits are shifted.

<expN2> Specifies the number of bit positions to shift. If <expN2> is not an integer, it is converted to an integer.

Example
BITLSHIFT(5,1) 5 = 0101 binary, 1 to shift 1 bit to the left

 

Returns: 10 1010 binary

BITOR( ) Function

Purpose Returns the result of a bitwise inclusive OR operation performed on two numeric values.
Syntax BITOR(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1>, <expN2> Specifies the numeric values on which the bitwise inclusive OR operation is performed. If <expN1> and <expN2> are not integers, they are converted to integers before the bitwise inclusive OR operation is performed.
Remarks

BITOR( ) compares each bit in <expN1> to the corresponding bit in <expN2>. If either bit in <expN1> or <expN2> is 1, the corresponding result bit is set to 1; otherwise, the corresponding result bit is set to 0. The following table shows the result of an inclusive OR operation on corresponding <expN1> and <expN2> bits:

<expN1> bit <expN2> bit Resulting bit
0 0 0
0 1 1
1 0 1
1 1 1
Example
BITOR(5,6) 5 = 0101 binary, 6 = 0110 binary

 

Returns: 7 0111 binary

BITRSHIFT( ) Function

Purpose Returns the result of shifting the bits of a numeric value to the right a specified number of positions.
Syntax BITRSHIFT(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1> Specifies the numeric value whose bits are shifted to the right. If <expN1> is not an integer, it is converted to an integer before its bits are shifted.

<expN2> Specifies the number of bit positions to shift. If <expN2> is not an integer, it is converted to an integer.

Example
BITRSHIFT(5,1) 5 = 0101 binary, 1 to shift 1 bit to the left

 

Returns: 2 0010 binary

BITSET( ) Function

Purpose Sets the bit to 1 in a numeric value and returns the resulting value.
Syntax BITSET(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1> Specifies the numeric value in which a bit is set. If <expN1> is not an integer, it is converted to an integer before its bit is set.

<expN2> Specifies the bit position in <expN1> that is set to 1. <expN2> can range from 0 to 31; 0 is the rightmost bit.

Example
BITSET(5,1) 5 = 0101 binary, 1 to set the second bit

 

Returns: 7 0111 binary

BITTEST( ) Function

Purpose Returns true (.T.) if a specified bit in a numeric value is set to 1; otherwise, returns false (.F.).
Syntax BITTEST(<expN1>, <expN2>)
Returns Logical
Parameters <expN1> Specifies the numeric value in which a bit is checked. If <expN1> is not an integer, it is converted to an integer before its bit is checked.

<expN2> Specifies the bit position in <expN1> that is checked. <expN2> can range from 0 to 31; 0 is the rightmost bit.

Example
BITTEST(5,0) 5 = 0101 binary,  0 to check the first bit

 

Returns:  .T.   true

BITXOR( ) Function

Purpose Returns the result of a bitwise exclusive OR operation performed on two numeric values.
Syntax BITXOR(<expN1>, <expN2>)
Returns Numeric
Parameters <expN1>,<expN2> Specifies the numeric values on which the bitwise exclusive OR operation is performed. If <expN1> and <expN2> are not integers, they are converted to integers before the bitwise exclusive OR operation is performed.
Remarks

BITXOR( ) compares each bit in <expN1> to the corresponding bit in <expN2>. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0. The following table shows the result of an exclusive OR operation on corresponding <expN1> and <expN2> bits:

<expN1> bit <expN2> bit Result bit
0 0 0
0 1 1
1 0 1
1 1 0
Example
BITXOR(5,6) 5 = 0101 binary, 6 = 0110 binary

 

Returns: 3 0011 binary

CEILING( ) Function

Purpose Returns the nearest integer that is greater than or equal to the specified numeric expression.
Syntax CEILING(<expN>)
Returns Numeric
Parameter <expN>  Include a numeric expression <expN> in CEILING( ). <expN> may be a number, or a numeric expression, memory variable, array element or database field.
Remarks CEILING() returns the nearest integer that is greater than or equal to a numeric expression. This function rounds all positive numbers with a fractional portion up to the next highest integer. CEILING() returns the integer portion of a negative number with a fractional portion.
Examples
CEILING(10.1) Returns: 11
CEILING(-10.9) Returns: -10

COS( ) Function

Purpose Returns the cosine of a numeric expression
Syntax COS(<expN>)
Returns Numeric
Parameter <expN> COS( ) returns the cosine of <expN>.

<expN> can be any value, and the value returned by COS( ) ranges between -1 and 1. <expN> is given in radians. To convert an angle from degrees to radians, use DTOR( ). The number of decimal places returned by COS( ) can be specified with SET DECIMALS.

Examples
COS(0) Returns: 1
COS(PI()) Returns: -1
COS(DTOR(60)) Returns: 0.5

COUNT( ) Function

Purpose Counts table records.
Syntax COUNT([<expr>])
Parameters <expr> Specifies an optional expression to count. <expr> can be a number, a numeric expression, a variable, a date, or a field.
Remarks COUNT() counts the records.
Example
COUNT(pol_idx) Returns number of records.

DTOR( ) Function

Purpose

Converts degrees to radians.

Syntax DTOR(<expN>)
Returns Numeric
Parameters <expN> Specifies the numeric expression whose value you want to convert to radians. An angle expressed in a degree:minute:second format should be converted to its decimal equivalent.
Remarks DTOR( ) converts the value of a numeric expression given in degrees to an equivalent value in radians. DTOR( ) is useful for working with the other trigonometric functions: ACOS( ), ASIN( ), COS( ), SIN( ), TAN( ). Use RTOD( ) to convert radians to degrees.
Example
DTOR(90) Returns: 1.57
DTOR(180) Returns: 3.14

EXP( ) Function

Purpose Returns the value of e^x where x is a specified numeric expression.
Syntax EXP(<expN>)
Returns Numeric
Parameter <expN> The numeric expression <expN> is the exponent, x, in the exponential equation e^x.
Remarks The mathematical function EXP( ) returns the value of e^x where x is a numeric expression.

The value of e, the base of natural logarithms, is approximately 2.71828. The number of decimal places displayed by EXP( ) is specified with SET DECIMALS

Examples
EXP(0) Returns: 1
EXP(1) Returns: 2.72

FLOOR( ) Function

Purpose Returns the nearest integer that is less than or equal to the specified numeric expression.
Syntax FLOOR(<expN>)
Returns Numeric
Parameter <expN> FLOOR( ) returns the nearest integer that is less than or equal to <expN>.
Remarks FLOOR( ) rounds a positive number with a fractional portion down to the integer portion of the number, and rounds a negative number with a fractional portion down to the next lowest integer.
Examples
FLOOR(10.5) Returns: 10
FLOOR(-10.2) Returns: -11

FV( ) Function

Purpose Returns the future value of an investment.

FV( ) computes the future value of a series of constant periodic payments earning fixed compound interest. The future value is the total of all payments and the interest.

Syntax FV(<expN1>, <expN2>, <expN3>)
Returns Numeric
Parameter <expN1> The equal periodic payment(can be negative or positive). FV( ) assumes that the periodic payments are made at the end of each period.

<expN2> The periodic interest rate. If the interest rate is annual but the periodic payments <expN1> are made monthly, divide the annual interest rate by 12.

<expN3> The number of periods payments are made.

Examples
FV(500,0.075/12,48) 500 payment, 7.5% annual interest, 48 monthly payments (4 years)

 

Returns: 27887.93
FV(100,0.05/12,12) 100 payment, 5.0% annual interest, 12 monthly payments

 

Returns: 1227.89

INT( ) Function

Purpose Evaluates a numeric expression and returns the integer portion of the expression.
Syntax INT(<expN>)
Returns Numeric
Parameter <expN> INT( ) returns the integer portion of the numeric expression <expN>.
Examples
INT(23.5) Returns: 23
INT(4.2) Returns: 4

LOG( ) Function

Purpose The mathematical function LOG( ) returns the natural logarithm of a numeric expression. The base for the natural logarithm is the constant e. The number of decimal places returned in the result is specified with SET DECIMALS
Syntax LOG(<expN>)
Returns Numeric
Parameter <expN> LOG( ) returns the value of x in the equation ex = <expN>. The numeric expression <expN> must be greater than 0.
Examples
LOG(1) Returns: 0
LOG(EXP(4)) Returns: 4

LOG10( ) Function

Purpose Returns the common logarithm (base 10) of the specified numeric expression. The mathematical function LOG10( ) returns the common logarithm of a numeric expression. The base for the common logarithm is 10. The number of decimal places returned in the result is specified with SET DECIMALS
Syntax LOG10(<expN>)
Returns Numeric
Parameter <expN>  LOG10( ) returns the value of x in the equation 10^x = <expN>. The numeric expression <expN> must be greater than 0.
Examples
LOG10(10) Returns: 1
LOG10(1000) Returns: 3

MAX( ) Function

This function is defined in String Functions.

MIN( ) Function

This function is defined in String Functions.

MOD( ) Function

Purpose Returns the remainder obtained by dividing a numeric expression by another numeric expression.

MOD( ) and the % operator return identical results.

Syntax MOD(<expN1>, <expN2>)
Returns Numeric
Parameter <expN1> is the dividend. The number of decimal places in <expN1> determines the number of decimals places in the result.

<expN2> is the divisor. A positive number is returned if <expN2> is positive, and a negative number is returned if <expN2> is negative.

Examples
MOD(58,10) Returns: 8
MOD(25.250, 5.0) Returns: 0.25

MTON( ) Function

Purpose Returns a Numeric value from a Currency expression.
Syntax MTON(<expM1>)
Returns Numeric
Parameter <expM1> Specifies a Currency expression whose value MTON( ) returns. <expM1> must evaluate to a valid Currency value or Visual FoxPro generates an error. Currency values are created by placing a dollar sign ($) prefix immediately before a Numeric value.
Remarks MTON( ) returns a Numeric value with four decimal places. Currency values are not used in TAM.
Example
MTON($2456.0000) Returns 2456.0000

NTOM( ) Function

Purpose Returns a Currency value with four decimal places from a numeric expression.
Syntax NTOM(<expN>)
Returns Currency
Parameter <expN> Specifies a numeric expression whose Currency value NTOM( ) returns. If <expN> has more than four decimal places, it is rounded to four decimal places. If <expN> has less than four decimals places, it is padded with zeros until four decimal places are created.
Example
NTOM(3957) Returns: $3957.0000
NTOM(prem) If prem is 620.75, it returns $620.7500

PAYMENT( ) Function

Purpose Returns the amount of each periodic payment on a fixed-interest loan.
Syntax PAYMENT(<expN1>, <expN2>, <expN3>)
Returns Numeric
Parameter <expN1> <expN1> is the beginning principal of the loan.

<expN2> The fixed interest rate per period is <expN2>. If monthly payments are made on the loan but the interest rate is annual, divide the annual interest rate by 12.

<expN3> The total number of payments to be made on the loan is <expN3>.

Examples
PAYMENT(1500,0.1/12,24) $1500 principal, 10% annual interest, 24 monthly payments

 

Returns: 69.22
PAYMENT(125000,0.075/12,360) $125,000 principal, 7.5% interest, 360 payments (30 years)

 

Returns: 874.02

PI( ) Function

Purpose Returns the numeric constant pi.

This mathematical function returns the numeric constant pi (3.141592), the ratio of the circumference of a circle to its diameter.

The number of decimal places displayed in the value returned by PI( ) is determined by SET DECIMALS

Syntax PI( )
Returns Numeric
Examples
PI() Returns: 3.14
ATAN(PI()/2) Returns: 1.00

PV( ) Function

Purpose Returns the present value of an investment.

The present value of an investment is computed as the value of the investment based on a series of equal periodic payments at a constant periodic interest rate.

Syntax PV(<expN1>, <expN2>, <expN3>)
Returns Numeric
Parameter <expN1> The periodic payment is specified by <expN1>. It can evaluate to a positive or negative number. PV( ) assumes that the payments are made at the end of each period.

<expN2> The periodic interest rate is specified by <expN2>. If the interest rate of an investment is annual and the payments are made monthly, divide the annual interest rate by 12.

<expN3> The total number of payments is specified by <expN3>.

Examples
PV(500,0.075/12,48) $500 payment, 7.5% interest, 48 months
   Returns: 20679.19

RAND( ) Function

Purpose Returns a random number between 0 and 1.

RAND( ) returns a random number between 0 and 1. A seed value of 100001 is automatically used if <expN> is omitted in the first RAND( ) function you issue. You can restore the default at any time with RAND(100001).

Syntax RAND([<expN>])
Returns Numeric
Parameter <expN> The seed value

<expN> lets you to specify the seed value to use with the function. Using the same positive value for <expN> in the first RAND( ) function you issue, and no <expN> in subsequent RAND( ) functions, always returns the same sequence of random numbers

.If <expN> is negative in the first RAND( ) function you issue, a seed value is created from the system clock. To achieve the most random series of numbers, use RAND( ) initially with a negative argument and subsequent RAND( ) functions without an argument.

Examples
RAND(5) Returns: 0.11
RAND() Returns: 0.90

RECCOUNT( ) Function

Purpose Returns the number of records in the current or specified table.
Syntax RECCOUNT([nWorkArea | cTableAlias])
Returns Numeric
Parameters nWorkArea Specifies the work area number for a table open in another work area. RECCOUNT() returns 0 if a table isn't open in the work area you specify.

cTableAlias Specifies the table alias for a table open in another work area.

Remarks The value RECCOUNT( ) returns isn't affected by SET DELETED and SET FILTER. RECCOUNT( ) without the optional arguments nWorkArea or cTableAlias returns the number of records in the table in the currently selected work area.

RECNO( ) Function

Purpose Returns the current record number in the current or specified table/.DBF.

The record pointer is positioned on the current record.

RECNO( ) returns a value that is one greater than the number of records in the file if the record pointer is positioned beyond the last record in the file. RECNO( ) returns 1 if the record pointer is positioned before the first record in the file.

If the table/.DBF has no records, RECNO( ) returns 1 and EOF( ) returns true (.T.).

Syntax RECNO([<expN> | <expC>])
Returns Numeric
Parameter
RECNO() Returns the record number from the current file.

ROUND( ) Function

Purpose Return a numeric expression rounded to a specified number of decimal places.
Syntax ROUND(<expN1>, <expN2>)
Returns Numeric
Parameter <expN1>

<expN1> is the numeric expression whose value is to be rounded.

<expN2>

<expN2> is the number of decimal places to round <expN1> to.

If <expN2> is negative, ROUND( ) returns a whole number containing <expN2> zeros to the left of the decimal point. For example, if <expN2> is -2 the first and second digits to the left of the decimal point in the value are zero.

Examples
ROUND(3546.654,1) Returns: 3546.7
ROUND(amt/12,2) If amt is 580.50, it returns 48.38.

RTOD( ) Function

Purpose Converts a numeric expression that represents radians to an equivalent value in degrees.

RTOD( ) converts a numeric expression given in radians to an equivalent value in degrees. RTOD( ) is useful when working with FoxPro trigonometric functions such as COS( ), SIN( ), TAN( ) and so on. Use DTOR( ) to convert degrees to radians

Syntax RTOD(<expN>)
Returns Numeric
Parameter <expN> is the numeric expression representing radians to be converted to degrees.
Examples
RTOD(1.57) Returns: 90
RTOD(ACOS(-1)) Returns: 180

SIGN( ) Function

Purpose Returns a numeric value of 1, -1 or 0 depending on whether the specified numeric expression evaluates to a positive, negative, or 0 value. SIGN( ) returns a numeric value of 1, -1 or 0 depending on the sign of a numeric expression.
Syntax SIGN(<expN>)
Returns Numeric
Parameter <expN> A 1, -1 or 0 is returned by SIGN( ). If <expN> is positive, SIGN returns 1. If <expN> is negative, -1 is returned. If <expN> is 0, SIGN returns 0.
Examples
SIGN(-30) Returns: -1
SIGN(235) Returns: 1
SIGN(0) Returns: 0

SIN( ) Function

Purpose Returns the sine of a numeric expression.
Syntax SIN(<expN>)
Returns Numeric
Parameter <expN>

SIN( ) returns the sine of <expN>. The numeric expression <expN> may assume any value, and the value returned by SIN( ) will range between -1 and 1.

<expN> is given in radians. To convert an angle from degrees to radians, use DTOR( ). The number of decimal places returned by SIN( ) may be specified with SET DECIMALS.

Examples
SIN(27) Returns: 0.96
SIN(PI()/2) Returns: 1.00

SQRT( ) Function

Purpose Returns the square root of the specified numeric expression. The number of decimal places in the value returned by SQRT( ) is the larger of the current decimal place setting and the number of decimal places contained in <expN>. The current decimal place setting is specified with SET DECIMALS
Syntax SQRT(<expN>)
Returns Numeric
Parameter <expN>

Specify the numeric expression to be evaluated by SQRT( ) with <expN> . <expN> must be non-negative (zero or greater)

Examples
SQRT(144) Returns: 12
SQRT(15) Returns: 3.87

SUM( ) Function

Purpose Total the values of <expN>.
Syntax SUM(<expN>)
Returns Numeric
Parameter <expN>
Remarks The <expN> in SUM( ) may be a number, or a numeric expression, memory variable, or a field.
Examples
SUM(prem) Returns the total of premiums for the records selected.

TAN( ) Function

Purpose This trigonometric function returns the tangent of an angle.
Syntax TAN(<expN>)
Returns Numeric
Parameter <expN>

TAN( ) returns the tangent of the angle specified with <expN>, which is given in radians. To convert an angle from degrees to radians, use DTOR( ). The number of decimal places returned by TAN( ) can be specified with SET DECIMALS.

Examples
TAN(0) Returns: 0
TAN(PI/4) Returns: 1

VAL( ) Function

Purpose Returns a numeric expression from a specified character expression composed of numbers.

VAL( ) returns a numeric value that corresponds to the value of the digits contained in a character expression. VAL( ) processes the numbers in the character expression from left to right until a non-numeric character is encountered (leading blanks are ignored). VAL( ) returns 0 if the first character of the character expression isn't a number

Syntax VAL(<expC>)
Returns Numeric
Parameter <expC>

Specify a character expression composed of eight numbers with <expC>.

Examples
VAL(‘12’) Returns: 12
VAL(‘4’)+VAL(‘33’) Returns: 37