Programmer's Perspective ] Ins and Outs ] WhereCode ] Typology ] Alphabetic Information ] Arrays and Looping ] [ Builtins ] Randomization and Simulation ] Controls ] Creating and Using Files ] Errors ] Key Codes ] Drive Office With VB ]

 

 


Built-in Arithmetic Functions

Usage

Value returned

ABS(number)

Absolute value (ignores sign)

ATN(number)

Angle (in radians) whose tangent is equal to number - to convert to degrees, multiply by 57.2958

CINT(real number)

Rounded integer

CDBL(number)

Double precision

CLNG(number)

Long integer

COS(number)

Cosine of angle specified by number.  Number is expressed in radians

CSNG(number)

Single precision

EXP(number)

e to the power specified by number (i.e., the antilog of the number)

FIX(real number)

Truncated integer.  For negative number, first negative integer greater than number

INT(real number)

Truncated integer.  For negative number, first negative number less than number

LOG(positive number)

Natural logarithm - uses base e.  To convert to base 10 logarithm, divide by LOG(10)

first MOD second

Remainder after dividing first number by second

RND

Random number between 0 and 1

SGN(number)

Sign of number: +1 if positive, -1 if negative, 0 if zero

SIN(number)

Sine of angle specified by number.  Number is expressed in radians

SQR(non-negative number)

Positive square root

TAN(number)

Tangent of angle specified by number.  Number is expressed in radians

Built-in String Functions

Usage

Value returned

ASC(X$)

ASC code for first character of X$

CHR$(n)

Character whose ASC code is n

DATE

Current date as mm-dd-yyyy

INSTR(X1$, X2$)

Character position of match if X1$ contains X2$, 0 if no match

LCASE(X$)

Lower-case version of the letters in X$

LEFT$(X$, n)

Leftmost n characters of X$

LEN(X$)

Number of characters in X$

LTRIM$(X$)

Removes leading blanks from X$

MID$(X$, n1, n2)

n2 characters in X$, beginning with n1

NAME F1$ AS F2$

Changes file name from F1$ to F2$

RIGHT$(X$, n)

Rightmost n characters of X$

RTRIM$(X$)

Removes trailing blanks from X$

SPACE$(n)

Creates a variable containing n spaces

STR(X)

Alphabetic representation of the value of X, with leading blank

STRING$(n, X$)

Alphabetic variable containing n instances of first character of X$

STRING$(n1, n2)

Alphabetic variable containing n1 instances of character whose ASC code is n2

TAB(n)

In PRINT or LPRINT, moves position to column n

TIME

Current time as hh:mm:ss

UCASE$(X$)

Upper-case representation of the letters in X$

VAL(X$)

Numeric value of X$