Dec 122017
Memory-resident calculator with formatted displays and direct paste to text.
File CAF23.ZIP from The Programmer’s Corner in
Category Science and Education
Memory-resident calculator with formatted displays and direct paste to text.
File Name File Size Zip Size Zip Type
CAF.DOC 38037 12060 deflated
CAF.EXE 29346 16755 deflated

Download File CAF23.ZIP Here

Contents of the CAF.DOC file

CAF 2.3

Resident Floating Point Scientific Calculator

Bob Eyer

Apr 30, 1992


The content of this archive is shareware: if you think it's a
worthy addition to your personal software, you might make a
contribution to the author. In return for your contribution you
will receive the most recent updates of the items mentioned in the
list below.

Simply purchase a money order from your bank in the amount of $20
US made out to Bob Eyer and send with your return address to:

Bob Eyer
1100 Bloor Street West
Suite 16
Toronto, Canada M6H 1M8

Please mention in your accompanying note whether you wish 5.25" or
3.5" diskette format, and state the name in which you wish
registration-only utilities to be registered.

Do not send checks. Checks cause problems across international
borders which make them unsuitable for small purchases by mail
order. Checks will be returned with your order unfilled.

Enquiries may be placed by writing directly to the author via
Easyplex at Compuserve [73230,2620].

Warranty and Disclaimer:
The author, Bob Eyer, of this and all items below guarantees the
physical integrity of the diskette covering the points above, and
will replace free of charge, if it is received defective.
However, in no case will the author be responsible for any damages
due to loss of data or any other reason. In no event does the
author's liability for any damages exceed the price paid for the
buyer's order of this software, regardless of the form of the
claim. The person using the software bears all risk as to the
quality and performance of the software.


The items listed below, except the ones with asterisk in the left
margin, are registered to you personally. As personally
registered to you, these particular copies may not be distributed
without the author's consent. Names of programs falling into this
category are all versions of MG, versions of SPC after SPC 5.4,
all versions of HOST, CA, and CAF. These programs may be freely
circulated only in their 'shareware' form. Versions of these
programs which are personally registered to the user must not be
so circulated. When you place an order by making your shareware
contribution under these terms, you are agreeing to abide by this

The asterisked items mentioned below are in fact collections of
new versions of Eyer utilities, most of the older versions of
which were posted separately. They have been combined into
packages in order to simplify processing orders at this end.

MG 3.0
Moving average ASCII graphing program. Especially designed for
obtaining graphic updates on stock-market activity in practical
trading environments, in which it is essential that the user get a
quick graph immediately, with points of the graph directly
associated with the numerical and other text information which
these points represent (a feat impractical in Lotus graphics).
Designed to be used with SETV in the SUTL package.

SPC 5.5
Multidrive columnar drive report, with fairly complete description
of your machine including communications, important chips,
printer, BIOS, memory, processor and coprocessor speed,
multitasking, networking, and so on, all in one single snapshot.
New version doubles the amount of information on each
communications port and displays the information in columnar mode
above the drive report, adds an environment usage readout as well
as a new P parameter to pause the PRINT multiplexer, when it is
used to feed data to your printer. (DOS PRINT lacks a pause

HOST 2.3
Provides a simple BBS host for occasional use. Fully
configurable, but capable of being run 'right out of the box',
HOST provides ringback, file transfer, mail, chat, userlog, shell,
and much more - in an executable only 27K in size.

CA 2.4
7-function fixed point TSR calculator with formatted displays and
scientific notation for direct paste to text. Also has
accumulator. Four mode groups. About 13K of memory.

CAF 2.3
Memory resident calculator with formatted displays and direct
paste to text, with minimum screen overlay. 24 functions,
including trig, factorials & combinations, mean & standard
deviation, regression analysis, much more. Six mode groups. CAF
is the most sophisticated calculator in the business for its
size. 32K of memory.

* FUTL 2.0
A collection of file processing utilities including -
CHG 2.8 - File/directory attribute/date/time reader/changer
ELIM 2.6 - Replacement for DOS DEL
FVER 2.1 - BBS file list verifier - automatic, redirectable
MV 2.8 - File mover, large improvement over MV 2.6.
MVA 2.1 - BBS file mover, reads from list, uses download path
OTL 3.0 - Operation to List, generalisation of MVA, for BBSes
RNF 2.2 - Puts special flags on filenames
SWP 2.0 - Single level sweep program, faster than SWEEP.COM
TYME 2.3 - Program execution timer
WD 2.6 - Applies wildcard to any program
Each is the best and smallest in the business for what it does.

* SUTL 2.1
A collection of small utilities covering batch file, diagnostic,
communications analysis, file, video, and other areas, including
SETV, SS, and TSTF. Includes a number of very useful memory
resident programs, such as AL(alarm) and PORT(analyser).

* TUTL 2.1
A collection of text-processing utilities, including ADD, CBRO,
CITM, COMB, DIV, ESRT, LCNT, REV, and SPLT. Except for LCNT (a
very fast wildcarded text linecounter), these programs cover
important ground in text processing for which there exists no
other alternative in the shareware market. Users who do much
work with ASCII text should not be without these utilities.


Help screen
Syntax: CAF [/U] Hotkey: Rightshift-/

Binary operations: + - * / ^ C P

Unary operations: SQ SQRT EXP LOG SIN ASN

Registers: E PI A B C X K M N R S

To quit from following areas, use Esc key -

Modes: places COLOR y RAD/DEG

Review: ST

See the note about Errors below.

Changes since CAF 2.0
- Much better input editor, allowing use of Esc key to exit; no
more jerky cursor action.

- Adds MEAN and REGRESSION special areas. ADD now integrated
into MEAN chiefly to save space. New display prompts put
results to the left the prompt.

- C added to binary functions - number of combinations of n things
taken r at a time. The math notation 'nCr' is somewhat modified
as 'a C b'.

- P added to binary functions - number of permutations, same
type of syntax as for combinations.

- ! added to unary functions - the factorial function. As for
all other unary functions, the function name MUST precede its
argument, and be separated by a blank. Thus the math notation
'10!' reads in CAF as '! 10'.

- MEAN area added - enables user to find the total, mean and
standard deviation of a list of numbers. Reserved for
registered users only.

- REGRESSION area added - enables user to find the correlation
coefficient of a series of paired data. Also computes the least
square regression line and other data for this series.
Registered users only.

- New registers for direct readout or paste: K (the y-intercept of
the regression line), M (the slope), N (the number of data in
the supplied scatter of points), R (the correlation
coefficient), S (the standard deviation for the MEAN).
Additional data, including the covariance of listed pairs,
available only in registered versions.

- New storage register X, for saving old results for re-entry into
subsequent calculations.

- Introduces DMS format ('degree-minute-second') for trig
functions. Default is No DMS (NODMS). Where DMS is set, CAF
treats the first two digits following the decimal point of
angles as the number of minutes, and the next four digits as
seconds correct to the nearest hundredth of a second. Only
works when DEG (degree) mode is set, and only on the trig
functions and their inverses.

- The PLACES mode is simplified so that the mere entry of a single
digit number causes CAF to change the number of places.
Formerly, the user had to type 'x PLACES' to get it to recognise
x as the number of places. Entry of the number of places now
affects all displayed numbers, as well as all those which are
pasted to the underlying application. In the MEAN and
REGRESSION areas, however, results are formatted to a minimum of
3 places within those areas unless places is set higher than 3.
If set to 0, results rounded to 3 places in the area windows
will appear to maximum precision on exit from those windows.

- The N/D modes are now changed to STUF/D. The reason is to avoid
conflict with the N register readout for the number of pairs of
data entered in the MEAN and REGRESSION areas.

- Extends to all unary functions the same coverage of register
input as applies to binary functions.

INTRODUCTORY NOTE: CAF is a floating point companion alternative
to CA (see program listing in Shareware Notice above), which is
restricted to four function fixed point arithmetic. CAF supports
24 functions. Registered versions of CA use about 12K of memory;
CAF uses about 32K. This is comparable to some of the simpler
floating point calculators, such as FFC, but, unlike these (which
are usually restricted to the standard four arithmetic functions),
CAF offers far more functionality.

CAF is not a general formula evaluator. If you need to do many
different kinds of calculations on the same text in one shot, it
may be more appropriate to use Lotus 1-2-3 or similar, print
results as a file, edit, and then insert into your text. CAF,
however, does provide a simple means of re-using input data for
subsequent calculations (see section below about Automatic
Store/Recall and also the discussion about register operations).
Also, CAF provides a method of adding many numbers before
injecting the sum to text (See Special Accumulator section below).

CAF's floating point emulator will take advantage of the
coprocessor, if one is installed. This advantage is noticeable
primarily on XT's and slow AT's, and primarily with regard to the
transcendental functions. Except for SQ, all Unary operations and
the power function are directly or indirectly based on infinite
series and/or the use of Newton's Method. The accuracy of this
range of functions is about 12 significant figures, rather than
the usual 15 for ordinary arithmetic.

CAF's real number range, apart from sign, is roughly between
1e-294 and 1.7e+308. This is much larger than is possible in the
companion program CA, and is also larger than the usual range for
many scientific calculators.

IMPORTANT: This program does not provide a menu or picture of a
calculator - so as to avoid obscuring portions of the underlying
editing application, and to avoid requiring the user to employ
only 25 x 80 screens (some TSR calculators require this, to make
use of Line 25 for calculator monitoring). CAF responds equally
well in 50 x 80 or 44 x 132 video environments; generally, it is
indifferent to the manner in which the video raster is defined.

CAF is designed to respond just to the hotkey, which provides
merely a 'calculation window', in which the user enters his
calculations or mode changes. Hitting ENTER after supplying a
calculation or mode change to the window, simply executes the job
and returns to the application. Where a result is generated, it
is pasted directly to the underlying application where the cursor
was last located.

In examples seen below, EACH calculation or mode change is
preceded by invoking the hotkey. This, however, does not apply to
special areas dealing with more complex problems, such as MEAN and

CAF is also designed to return the cursor to the initial position
in the main calculation window, to permit making mode adjustments
without line skipping. Once a task is completed, you may exit the
window merely by hitting ENTER one additional time or by using the
spacebar to delete the window. The old window always disappears
in an editing environment after the result is injected to the
text, but mode change information will, in general, remain.

CAF provides 6 groups of mode selections - number of decimal
places to which to round results, colour of calculation window,
whether to use Radian or Degree measure, what base to use for the
EXP and LOG operations, whether to echo the result to display or
paste to text, and whether to use DMS format in trig calculations.

The current mode situation may be viewed simply by entering ST in
the calculation window (ST is short for 'status').

Mode changes are entered directly in the calculation window and
the new mode specs are resummarised in the calculation window,
just as though ST had been issued.

Entry of 5 in the calculation window will cause CAF to operate so
as to round all results to five decimal places. Entry of 0 means
that no formatting will occur. The default value is 0.

Entry of 'COLOR 30' will cause the calculation window to have a
bright yellow foreground and a blue background. For colour
details see below. The default colour scheme is black on white
(112). Color 0 automatically converts to 112, so as to avoid
black on black.

Entry of RAD in the window causes CAF to assume all angles entered
as arguments in trig functions are in radian measure. Entry of
DEG puts CAF into Degree mode. The default is Degree mode.

CAF supports three bases for use with the LOG or EXP functions.
TWO means Base 2; NAP is short for the Napierian base (2.718 ...)
and means Base e; and TEN means Base 10. The default is Base e.

STUF means normal (stuff the result to the underlying
application), and D means display (that is, display at TSR video
level). STUF is the default. STUF mode injects results to the
underlying application; display mode echoes results to the screen
without pasting to the application at all.

Register operations
CAF supports pasting 11 registers direct to text. For example,
after invoking the hotkey, we simply enter

e [= 2.7182818284590

(the use of the left bracket here merely signifies that the result
appears at the underlying application, not at TSR level)

In addition, the user may simply enter A, B, or C to examine the
last value stored in CAF's "store/recall" facilities (see
below), as well as the general storage register X, and the
statistics registers.

Binary operations
CAF supports seven two-variable ('binary') operations: + - * / ^ C
P, or add, subtract, multiply, divide, raise to a power,
combinations and permutations, respectively. For example,

1991-1917 [= 74

7e-6+3e-4 [= 0.000307

3.33e+1+4.56e-3 [= 33.30456

When entering exponentially formatted numbers one must specify a
sign (+ or -) immediately after the 'e' symbol.

Additional examples:

35/34 [= 1.0294117647058
35*34 [= 1190

35^34 [= 3.1500214e+52

10 C 4 [= 210 (210 combinations of 10 things
taken 4 at a time)

Unary operations
CAF also supports 10 unary transcendental functions, grouped by
inverses, as well as three hyperbolic functions, and the factorial
function. Here, a blank must separate the name of the operation
and the number which the operation takes as its argument.

! 6 [= 720 (factorial 6)

SIN 45 [= 0.7071067811865
COS 1 [= 0.9998476951563

LOG 2 [= 0.6931471805599
EXP 1 [= 2.7182818284590

SQRT 2 [= 1.4142135623731

If you wish to use Base 10 logarithms, just enter TEN in the
window, and then

LOG 2 [= 0.3010299956639

Note: the EXP function is in fact an antilog function, since it is
subject to the same range of base changes as is the LOG function.
This may be inconvenient to some users who assume that the
exponential function must always have base e, but implementing a
separate antilog function seemed, in the circumstances, merely to
be useless duplication of what is, essentially, a quite flexible

The internal setup for the hyperbolic functions is the same as for
the trig functions. If you select DEGree mode, CAF will convert
your degree measure into the radian equivalent before calculating
the function. If you select RADian mode, CAF will do no such
conversion, but will inject your argument directly to the

Automatic store/recall
If you are doing several calculations which involve use of the
same term, you may reduce typing further by using variables.
Calculation window variables are A, B, and C. The first time
you execute a calculation with numbers, the first number is
always stored into A, the second number into B, and the result
into C. These values can be re-used, simply by employing these
variables in subsequent calculations [except, of course, for the
fact that, as each new calculation is done, the value of C will
be updated with the new result].

Example (after entering 3 in the window):

Suppose we wish to perform the following calculations -

34.21102 x 435, and
34.21102 / 355.5

Here, each calculation uses the same initial term. We proceed
as follows, each time by hitting Rightshift-slash, and entering
the calculation shown:

34.21102 * 435 [= 1.488e+4
a/355.5 [= 9.623e-2

The second calculation above could be repeated merely by entering


The user may also proceed to obtain results for the other three
operations, using the same numbers, as follows:

a*b [= 12162.018
a+b [= 389.711
a-b [= -321.289

The output C-variable can also be used in calculations. For
example, we may first calculate with no scientific notation

2/3 [= 0.667 ]

Here, A = 2, B = 3, and C is the result in brackets. Now, if we
multiply the result C by 3, we should get back the numerator A:

C * 3 [= 2.000

This example illustrates the fact that CAF, like handheld
calculators with the store/recall function, stores results in a
separate register before rounding. It is this separate register
that is used for input, when the user employs C in a
calculation. [otherwise, the user might get back 2.001].

This type of 'result protection' on use of a previous result is
not, however, found in most TSR calculators.

All these remarks apply also to CAF's trig functions. For
example (using 5 decimal places),

SIN 89 [= 0.99985

We may now get back the value of the argument, simply by
performing the inverse (ARCSINE or ASN) on the result:

ASN C [= 89.00000

The same principle also works with squares and squareroots, as
well as logs and exponentials. For example,

LOG 2 [= 0.69315

but the argument '2' may be had by performing the inverse on the

EXP C [= 2.00000

You may also store a previous input or result into the general
storage register X. Just use, for example,

X= C or X = C

to store the value of C into X. X may be recalled simply by
entering X by itself, or by using it as an argument in any

ADD (special accumulator)
Entry of the keyword ADD in the calculation window, will transfer
control to a special area of CAF, which displays the following
type of prompt:


Numbers entered at this prompt are totalled, each total being
echoed in the left half of the display. If the next number in the
series is the same as the previous number, you may simply enter X
at the prompt; CAF interprets X as the previous value of the
argument entered. The same principle applies where you merely
wish to add the previous total to itself: use C.

Hitting the Esc key finishes the operation, wipes the special
window from the screen (if you're in an editing environment), and
injects the result to the underlying application if CAF is in STUF

MEAN (Total, Mean and Standard deviation)
Entry of the keyword MEAN in the calculation window will
transfer control to a special area of CAF which displays the
following type of prompt:


Numbers entered at this prompt are totalled and in passing CAF
also computes the mean and standard deviation for all numbers
entered, displaying these results in the stated order to the left
of the prompt.

If the next number in the series is the same as the previous one,
you may simply enter X at the prompt; CAF interprets X in the MEAN
window as the value of the argument last entered. The same
principle applies where the user wishes merely add the previous
total to itself: use the result register C.

The data displayed to the left of the prompt are displayed as
rounded to a minimum of 3 places.

When finished entering data, simply hit the Esc key to paste the
Total to the underlying application. The other data are available
by entering the following variable names:

X - Mean.
S - Standard deviation
N - Number of data entered.

The main result, the total, may be reaccessed by using register C.

For the interest of statistics people, the definition of standard
deviation used in CAF assumes the "n - 1" basis. That is, it is
based on multiplying the the root mean square of the data by the
square root of the ratio of N to N - 1. The purpose of the n-1
basis is to obtain a more realistic value for the standard
deviation in small sample applications than is possible with a
mere variance calculation.

The value of this routine is primarily to obtain quick results on
small amounts of data found directly on the screen in the
underlying application. If you have a large job to do, involving
many points, your best bet is to use a large program such as LOTUS

MEAN is available only to registered users.

REGRESSION (regression analysis)
Entry of the keyword REGRESSION in the calculation window will
transfer control to the REGRESSION area of CAF.

Here, the prompt will change between




and CAF will issue a beep to the speaker each time a Y value is
entered. Three running results are displayed to the left of the
prompt: The correlation coefficient, the y-intercept of the
regression line, and the slope of that line. The previous value
of X may be entered at either prompt by using X, and the previous
value of Y may be entered at either prompt by using Y. If you
enter C (the result register) the current correlation coefficient
will be entered at the prompt in question. Avoid, unless you
really want to do that.

But otherwise, operation of the REGRESSION area is similar to
that in MEAN.

On use of Esc to exit, CAF will paste the correlation
coefficient to the underlying application. To paste the
y-intercept, use K; and to paste the slope, use M. The
regression line has the standard form,

Y = K + MX

As usual, N is the number of pairs of data entered in the
REGRESSION window. The correlation coefficient may be obtained by
entering R.

REGRESSION is available only to registered users.

Prompt Colour
As stated above, to change the colour of the calculation window,
simply enter


in the window, where x is a COLOR number. The default is 112,
which describes black foreground on a white background. 0 is
impossible (black on black), and so CAF converts that number to
112 automatically. Foreground and Background colours may be
determined by using the following table:

Back Fore Bright Fore
---- ---- -----------
Black 0 0 8
Blue 16 1 9
Green 32 2 10
Cyan 48 3 11
Red 64 4 12
Magenta 80 5 13
Brown 96 6 14
White 112 7 15

The correct COLOR number is found merely by adding the Foreground
number to the Background number desired. For example, Bright
Green on Blue background is 10 + 16 = 26.

Avoid setting COLOR above 127. Values above that limit will
produce blinking displays.

In my estimation the COLORs best for the eye are 10, 11, 14, 15,
26, 27, 30, 31, 74, 75, 78, 79 and 112. But you may have other
ideas. Example,


sets the window to Bright Cyan on a Red background.

CAF supports error reports as follows -

xyz: illegal - This message occurs where your entered
instruction, 'xyz', is not recognised by
CAF. For example, 'TAN89' is illegal;
should be 'TAN 89'.

Read examples in documentation above to
be sure you understand how to enter

Illegal X setting - This means that you have tried to save
the value of unsupported register into
X. The supported registers are listed
on the help screen.

Zero divide error - Attempt to divide by zero. This can be
an explicit mistake, like '5 / 0', or it
may be an attempt to calculate the value
of a unary function which divides two
other functions to obtain its result.
For example, the TAN, or Tangent of an
angle, is really the ratio of the Sine
and the Cosine of that angle; but the
Cosine of 90 degrees is zero, so trying
to find the Tangent of 90 will generate
this error.

Negative base error - You tried raising a negative number to a
power (cannot be done on real numbers).

Negative argument error - You tried taking the LOG of a negative
number (cannot be done on real numbers).

Requires registration - This means you are trying to access a
function accessible only to registered
users. (Send in your contribution, and
get full access plus much more!)

Certain types of editors will not work consistently with CAF - in
particular, editors which simulate the Macintosh console
environment, such as the Microsoft DOS 5.0 Editor. Like Microsoft
Windows, these environments do certain tricks with video display -
and, so I understand, certain tricks to redefine one or more
interrupt functions - which lead to machine hangs when CAF and
other similar TSR's are run concurrently with them. (The problem
here is not unique to CAF, as collateral testing of other TSR
calculators has shown). If you're serious about computing, don't
use graphics user interfaces (GUI's)!

Further, like all memory resident programs, CAF is vulnerable to
compatibility problems which may arise from its use with other
TSR's. If you find you must reboot, try removing other memory
resident programs from your AUTOEXEC.BAT file, or try changing the
sequence in which they are loaded until you find the best

However, tests have shown that CAF is much less vulnerable to
interrupt collisions and other compatibility problems than other
resident floating point calculators.

One category of TSR which is almost guaranteed to cause trouble
for CAF (and for any program which stuffs keystrokes into the
keyboard buffer) are programs like 128KEY.COM, which lengthen or
change the effective size of the keyboard buffer. Don't use such
programs with CAF.

CAF is primarily intended to work with editors and wordprocessors,
and has been tested on Wordperfect 5.0, Galaxy 2.42, Captain
Blackbeard 1.13, SLED 1.1, QEDIT 2.08, pEDIT 2.10, and a number of
other editors/wordprocessors, with no confirmed problem or

CAF is recommended for use as the last memory resident program
loaded, so as to permit the use of the /U commandline option to
unload it from memory, and only in standard text-editing or
wordprocessing applications. Unless you have found that CAF works
with your non-standard application, it is recommended that you
take the precaution of unloading CAF before you invoke such an

End of documentation

 December 12, 2017  Add comments

Leave a Reply