Dec 052017
 
PC Magazine Volume 9 Number 10.
File VOL9N10.ZIP from The Programmer’s Corner in
Category Files from Magazines
PC Magazine Volume 9 Number 10.
File Name File Size Zip Size Zip Type
COMPUTE.ASM 43507 8048 deflated
COMPUTE.BAS 13737 3802 deflated
COMPUTE.COM 2560 1795 deflated
COMPUTE.DOC 2071 940 deflated
DEBUGBAT.BAT 1080 523 deflated
GETCOMND.BAT 434 267 deflated
NUMBERS.PAS 8501 1847 deflated
PARAVIEW.EXE 109352 52864 deflated
PRSTAT.COM 77 77 stored
THREADS1.ZIP 9339 9172 deflated

Download File VOL9N10.ZIP Here

Contents of the COMPUTE.DOC file


UTILITIES
MICHAEL J. MEFFORD
Vol. 9, No. 10
COMPUTE

Command

Purpose: A five-function calculator (addition, subtraction, multiplication,
division, and modulo functions) that works directly from the DOS
command line prompt.

Format:COMPUTE arithmetic expression

Remarks: COMPUTE accepts decimal numbers only, and the operators in its
arithmetic expression are +, -, *, /, and %. Note that the % symbol
does not stand for percent, but rather designates the module operator,
which returns the remainder of an integer division.
(Example: COMPUTE 8 % 5 returns the value 3, since 5 goes into 8
once with a remainder of 3.) When working on real numbers with a
fractional part the modulo operator in COMPUTE rounds off the
operands before the division.

The standard order of precedence for arithmetic operations is
followed by default. Multiple levels of parentheses and/or square
brackets are supported, however, so that the order in which
calculations are made can be modified. Thus, while COMPUTE 4 + 5 * 2
returns the value 14, the command COMPUTE (4 + 5) * 2 returns 18.

COMPUTE stores its last calculated result within its own .COM file.
This number, designated x, can be recovered and used in the next
calculation, whose result becomes the new x. The value of the
currently-stored x can be seen by entering the command COMPUTE x,
and x can be used as an operand, as in COMPUTE x + 5.

The program can handle decimal numbers up to 20 digits on either side
of the decimal point. Rounding errors are precluded by using a binary
coded decimal (BCD) format. Under DOS 3.x and later, COMPUTE can be
renamed to a shorter name to save keystrokes. Under DOS 2.x, however,
the program cannot be renamed and must be stored either in the current
directory or in one designated in a PATH= statement.




 December 5, 2017  Add comments

Leave a Reply