***********************************************
eCalc - A program to find e - about 2.718281828
***********************************************

Requirements to using eCalc V2.5:
- Amiga with 68020 or better CPU  (a FPU is not needed and not used anyway)
- Workbench/Kickstart 2.04 or better (I haven't tested it with less than 3.0)
- About twice as much bytes memory as the accuracy you want e
- Time (and patience!)

It uses no external libraries.

This program is Freeware: It may be distributed freely for non-commercial
purposes. It should be free and a copying fee must not exceed £2.
This program may not be distributed with any magazine-coverdisk without
written permission. It may be included in any PD-library or on CDs including
PD software, such as the Fish, Aminet and other series including similar
free software.

The program and this docfile may not be changed or modified!

YOU USE THIS PROGRAM ON YOUR OWN RISK. THE AUTHOR CAN NOT AND WILL NOT
GUARANTEE ITS ACCURACY, NOR ANY OTHER DAMAGES ARISING FROM ANY USE OR
MISUSE OF THIS PROGRAM AND DOCUMENTATION.

If publishing a result produced by eCalc, please give credit to the author
and state which version of the program you used (V2.5).

History
-------

This program was originally made in only 20 minutes modifying the sourcecode
of my piCalc program (calculates pi). It is many times faster than piCalc
though and should be able to calculate

How to use it
-------------

eCalc is Shell/CLI-only utility. To use it you have to open a shell-window.
In its simplest form you write (from Shell)

You can always stop the program with Ctrl-C.

"eCalc XXXXX" where XXXXX is the number of decimals eCalc should calculate.

The higher number of decimals the more time the calculation will take. If you
think of calculating many decimals (more than 20000) you should run eCalc
with the "ESTIMATE" option:

"eCalc estimate 100000" will estimate how much time a calculation of 100000
decimals will take, so that you won't be surprised by how slow things are
going.

If you want to save the result to a file, use "SAVEFILE=filename", the result
will be written to this file when it has finished.


Those options in full
---------------------

Type "eCalc ?" for the eCalc Template:

DECIMALS/N,EVERY/N,SAVEFILE,SAVEEVERY/N,NOTIFY/S,NOOUTPUT/S,ESTIMATE/S


DECIMALS
is the number of decimal places you want eCalc to calculate, this must be
between 1 and 2,147,483,647. Except when "ESTIMATE" is selected, you will
need just below twice as much memory free as the number of decimals you
want to calculate e to. (e.g. 1,000,000 decimals requires almost 2 MB
memory.)
(If not specified, the program uses 45 decimals)

EVERY
is how often you want eCalc to output its current calculation of e. If you
use "EVERY 10000" eCalc will output to screen (StdOut) when it has 10000, 
20000, 30000 and so on of decimals. This option is probably most useful when
used with the "NOTIFY" option.

SAVEFILE
when specified eCalc will save its calculation to the specified file, this
it a much nicer method than running eCalc with a ">" redirection file.
Beware: If eCalc can't create this file it would not give any error messages,
just continue on!

SAVEEVERY
specifies how often eCalc should save its current calculation to SAVEFILE.

NOTIFY
is a very useful option in conjunction with the EVERY and SAVEFILE
options. It notifies you how far it has come, writing "Dec: XXXX"  to the
Shell-window, where XXXX is how many decimals it has calculated so far, so
you have some kind of control of the process. Write NOTIFY EVERY 1000 to
have eCalc notify you every time it has calculated 1000 new decimals.

NOOUTPUT
is useful when you use the SAVEFILE option and don't want e to be
echoed to screen as this can take quite a while with many decimals.

ESTIMATE
will estimate the TIME needed to calculate e. The estimating may take
a number of seconds (2-6) but will display a rough indication on how
long the calculation will take: You should not touch the mouse or keyboard
during this test, as this will cause eCalc to over-estimate the time needed.


Is eCalc calculating the right value for e?
---------------------------------------------

Actually I don't know, it uses the same routines as piCalc and piCalc seems
calculate pi correctly. The first decimals of e seems to be correct, as I
have made another (extremely much slower) program using the definition and
got the same value. You should not depend on eCalc giving you the right
value, but it is probably correct (I hope).

Please don't have a large number of other programs running when eCalc
is busy calculating. A single bug in any of the programs running alongside
eCalc could accidentally write to a memory location used by eCalc and
giving a wrong result as eCalc does absolutely NONE checking on the
result as this would decrease performance considerably.


Program technicals (programmers)
---------------------------------

This program uses 32/64 bit integer math, using the Mulu.L/Divu.L instructions
heavily. The speed of this program therefore is largely dependent on the speed
the CPU carries out such multiplications and dividitions. The program stores
e in longwords, each containing 9 digits. This limits the program to values
multiple by 9. (9,18,27,36...)

Why is 68020 required?

Just because I was able to make the program 3 times faster when I could
68020 instructions instead of 68000 only.


Program technicals (math)
-------------------------

Calculation method:

e = 1/0! + 1/1! + 1/2! + 1/3! + 1/4! + 1/5! ...

where
0! = 1
1! = 1
2! = 1 * 2 = 2
3! = 1 * 2 * 3 = 6
4! = 1 * 2 * 3 * 4 = 24 and so on

If you know a better formula/method or know another e-calculation program
(that is faster), please write to me!


Author
------

Write if you know of any SERIOUS bugs (e is not accurate, fails on 68060,
etc.) If you have calculated e with more than 1,000,008 decimals using this
program or know a more efficient formula or another Amiga program that is
faster, please write! 

PS: Also try my program piCalc V2.5 that is identical to eCalc V2.5 except
that it calculates pi=3.14159265358979323846264338327950... (I only know
the number this far by heart!)


My address:
Steffen Thorsen
Fjordgt. 8a
N-4300 Sandnes
Norway

(No EMail yet, but I'll have Internet access from September 1995)
