Table of contents Previous: McBASI Interpreter Commands STOP Next: McBASI Sample Programs

Functions

The following functions are available. x and y refer to numeric expressions; a$ and b$ refer to character expressions.

Function Meaning
SIN(x), COS(x), TAN(x) trigonometric functions; x is an angle in radians;
ASIN(y), ACOS(y), ATAN(y) the arc functions return values in radians
EXP(x) exponential
LN(x) natural logarithm
LOG(x) base ten logarithm
ABS(x) absolute value of x
INT(x) integer part (truncated value) of x
NINT(x) nearest integer value to x
MOD(x,y) the remainder resulting from x/y
LEN(a$) length of the string in a$
INDEX(a$,b$) location in a$ string of b$ substring; if b$ is not in a$, zero is returned
VAL(a$) numeric value of string a$
SQRT(x) square root of x
STR$(x) calculates the string corresponding to the number x using McIDAS function CFG for the conversion
MID$(a$,x,y) extracts a string of length y from a$, starting at character position x (first position = 1)
TIME$ a pseudostring variable of length 6 which has the current time in the format HH:MM:SS
DATE$ a pseudostring variable of length 7 which has the current date in the format CCYYDDD
DAY$ a pseudostring variable of length 6 which has the current date in the format YYMMDD
TFILA$ . . TFILE$ a pseudostring variable of length 9; a temporary LW file named during execution of a BASIC program; it is deleted when the program terminates; five temporary LW files are available per program execution EOF$ a pseudostring variable; contains the universal value Z80808080
PEEK(x) returns a value from User Common (UC) location x; the value in UC is assumed integer and is converted to REAL*4
PEEK$(x) returns a character string
BIN(string$) the real number equivalent of the binary integer value in string$; assumes the first four bytes are an integer value (in binary)
BIN$(x) returns an ASCII string equivalent to the integer value of x
CHR$(x) returns a string of length one which is equivalent to the ASCII code value x
KSYS(x) returns the value from the System KeyTable location x; the value in SYSKEY is assumed to be an integer and is converted to REAL*4
KSYS$(x) returns the value from the System KeyTable location x; the value in SYSKEY is assumed to be a character string of length 4
TABLE$(a$) returns the value of the string stored in the current string table under the name a$
STATUS numeric pseudovariable set to the value of the exit status each time a KEYIN is performed; a nonzero status usually indicates failure


Table of contents Previous: McBASI Interpreter Commands STOP Next: McBASI Sample Programs