270 Chapter 7 BASIC Language for the 3458A
general math functions, trigonometric functions, and binary functions are
available. The 3458A also has a simple calculator mode.
Math Operators In addition to the standard math operators (+ – * / ^), two additional arithmetic
operators exist in the 3458A. These operators are DIV (integer division) and
MOD (modulo). Unary minus operations should be written as:
A = 0-B
The DIV command returns the integer portion of a division. Normal division
takes place but all digits to the right of the decimal point are truncated (not
rounded). The following program divides 7 by 3 and displays the integer
portion of the division (2) on the system controller.
10 OUTPUT 722; "OUTPUT(7 DIV 3)"
20 ENTER 722; A
30 PRINT "DIV Result ="; A
40 END
Typical Printout:
DIV Result = 2
The MOD command returns the remainder portion of a division. As with the
DIV command, normal division takes place; however, MOD returns only the
remainder. The following program divides 7 by 3 and displays the remainder
portion of the division (1) on the system controller.
10 OUTPUT 722; "OUTPUT(7 MOD 3)"
20 ENTER 722; A
30 PRINT "MOD Result="; A
40 END
Typical Printout:
MOD Result=1
Relational math operators (< > <= >= <>) and logical operators (AND and
OR) are allowed in any expression.
General Math Functions The following table lists the general math functions available in the 3458A.
The arguments (denoted by "X" and "Y") may be numbers, numeric
variables, functions, array elements, or numeric expressions in parentheses.
Logarithmic Functions The 3458A can compute both natural and common logarithms. The
logarithmic functions are shown in the following table.
Function/Argument Meaning
ABS(X) Absolute value of argument.
SQR(X) Positive square root of argument.
Function/Argument Meaning
LOG(X) Log
e
(X): Natural logarithm of a positive
argument to the base e (2.71828).