home *** CD-ROM | disk | FTP | other *** search
-
-
-
- **********************************************
- ***************** ADAM_V3 ********************
- ************ calculation-program *************
- *************** documentation ****************
- **********************************************
-
-
-
- Introduction :
-
- ADAM_V3 is the third version of a calculation program that is able
- to calculate numbers to a length of some thousand digits before
- and after the decimal point.
- The program needs no disk-resident libraries, only the file `pidat`
- should be in the same directory as ADAM_V3 (Otherwise the program
- shows an errormessage and you can only use 8 digits of pi).
-
- Starting ADAM_V3 :
-
- To start the program either doubleclick on the icon or type
- `adam_v3_600` in the cli but be shure the current directory is
- the directory the program is in.
- When you start from the icon the commands "iconx" and "run" must
- be in the c: directory.
- The program opens a window and displays the main menu.
-
- How to use ADAM_V3 ---- The Main Menu :
-
- From the main menu you get to the two branches of the program
- and you can leave it here with `f1`.
-
- By pressing `f2` you get to the `calculation part` where you can
- type numbers in and calculate with them, like on a pocket calculator.
- You can now type in a number (or many numbers !), press <ENTER>
- and type for example `*`, press <ENTER> again and type the second
- number and then the result is printed. Then you can press
-
- f1 for the main menu
- f2 to calculate again
- f3 to calculate again with your result as first number
- f4 to change the printing format
- when the format is `formatted` the numbers after
- the decimal point are printed in columns.
- f5 to copy your result to the memory and calculate again
- f6 to display the heltext (same as in the main menu)
-
- Pressing `f3` starts the pi-calculation-routine. At the beginning
- the count of iterations is requested (e.g 30). Then the calculation
- starts. It can be interrupted by pressing the left mousebutton.
- Then you can save the result to a file.
-
-
- `f4` shows the helptext that explains in detail the typing in
- of numbers and displays all commands.
-
- Whith `f5` you can change the language from English to German and
- vice versa. Default is English.
-
- Sorry :
-
- I tried to prevent my program from crashing caused by user entries
- (it detects various errors e.g. division by 0 and others) but
- you can never be shure ... At least my program has never crashed
- in this version on my Amiga500.
-
- There are two versions of my program. The one called `ADAM_V3_600`
- has 300 digits before and as many after the decimal point and the
- other one `ADAM_V3_1400` has 700 before and 700 after it.
-
- Copyright :
-
- This programm is published as public domain. That means you can
- make use of the program and the sourcecode as you like whithout ANY
- restrictions. My only request : When you copy the program to your
- friends you should copy ALL files in the directory.
-
-
- ************************************************************************
-
-
- Some internal information :
-
- The following part tells about the structure of ADAM and is
- probably only interesting for other programmers.
- The program was written on the SEKAV3.0 assembler and is my third
- (and probably last) version of a program that was intended to be
- able to calculate numbers of ANY length before and after the
- decimal point. That was soon limited most gravely by the 68000
- processor`s 7 MHz speed. It should be no problem to assemble
- it whith any other assembler because it uses no include files.
- The (german) sourcecode is included in the file `ADAM_V3.source`.
-
- About the arrays of numbers :
-
- Each number is represented completely in the fixed point array,
- i.e. the exponential representation (3.45 * 10^67) is not possible.
- The number is coded in bcd-technique, that means each byte holds
- two decimal digits.
- The size of the number can be varied seperately for the pre- and
- post- decimalpoint-part. It is defined as a constant in the
- sourcecode, i.e. it cannot be changed by the program but
- it must be newly assemled. In the constant declaration at the
- beginning of the sourcecode are the two most important variables:
-
- e.g. vst=200
- nst=300
-
- vst is the number of dezimal digits before the decimal point and
- nst the number of digits after it. Both numbers must be dividable
- by 4 without rest !!!.
-
- Structure of a number array :
-
- As I said each byte holds two dezimal digits, so the first
- vst+nst/2 bytes of an array hold the number digits. The following
- ten bytes contain some information about the number.
- After the constant definition for vst ( VorkommaSTellen) and
- nst ( NachkommaSTellen ) there are three other constants:
-
- st1=sb+2
- st2=sb+4
- st3=sb+6
-
- sb is vst+nst/2 i.e. the binary length of the number. Supposing
- in a0 the basic adress of the array then in st1(a0) is the number
- of decimal digits before the decimal point, in st2(a0) is the
- number of decimal digits after the decimal point and in st3(a0)
- is the sign (1 = 0, 2 = +, 3 = -).
-
- An example :
- vst=8
- nst=8
- number : 67.038
- representation in the array :
-
- 00 00 00 67 03 80 00 00 00 00 00 02 00 03 00 02
-
- The number 0 is represented as
-
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
-
- In the sourcecode each array is only a longword that holds the
- basic adress of the array. If you need more variables you have
- to put them in in the `allocmemory` routine.
-
- Accuracy :
-
- The basic mathematical routines ( +, -, *, / ) are exact to the
- last digit ( at division and multiplikation the last digit is
- rounded). There can only problems with repeated square-rooting
- because of addition of inaccuracies.
-
- The calculation routines :
-
- unsigned :
- plusu, minusu, veru, feldloesch, kopieren, tausch
-
- signed :
- pluss, minuss, mals, div, vers
-
- and :
- sqrroot : squareroots a number
- fakultaet : faculty
- quadrat : square
- integer : deletes the part after the decimal point
- sinus : sinus function
-
- zahlein : reads a number
- druck : prints a number
- alldruck : prints all bytes of an array (like a hex-dump)
-
- Errors :
-
- These errors do not display a message :
-
- - window could not be opened
- - not enough memory
-
- After one of these error has been recognized it is reported on the screen
- and the prorgram continues whith the main menu.
-
- - vst or nst are irregular (program ends)
- - division by zero
- - error in signword (when you have a wrong basic adress for an
- array). This error does usually not occur when you work whith
- the program. It can happen when you write your own calculation
- routines.
- - squareroot of a negative number
- - overflow at addition, multplikation and division
- - error at faculty
-
- Calculation of pi :
-
- As an example for the use of my calculation routines I have
- writte a routine that calculates pi with the arcustangens series
- by Machin :
-
- pi = 4 * ( 4*arctan(1/5) - arctan(1/239) )
-
- arctan(x) = x - x^3/3 + x^5/5 - x^7/7 + x^9/9 ...
-
- After each iteration pi gets roughly one decimal digit more
- arrurate.
-
- Speed :
- When you have small numbers (to about 400/1000) you can follow
- the development very well, but with increasing nst you can go
- to a concert while your computer calculates like mad and still
- does not get ahead.
- It takes some time to print the result of each iteration to
- screen so I included the possibility to let it run without
- printing. You can achieve this by typing `q` after you have inter-
- rupted the calculation with the left ratbutton ( I admitted the
- right shiftkey too because my left mousebutton is fucked up).
- You can make the program print the result again by interrupting
- it again and typing `q`.
-
- Accuracy in calculating pi :
-
- When you let the program run with nst=600 you get 597 digits
- of pi. You can extend this to longer numbers.
-
- In one run I had following data:
- vst=400
- nst=3300
- After a time of roughly 2 1/2 hours the result was accurate to
- 3240 digits.
-
- Name of the program :
-
- Why does this weird German programmer call his work ADAM ?
- I tell you here : 1. It was my first BIG machine code program
- 2. It is a reference to ADAM RIESE who intro-
- duced calculating with arabic numbers
- in the DARK Middle ages
-
- Earlier versions :
-
- ADAM_V1 :
- The first, slowest version, calculated pi in a time of about
- 24 (24 !!!) hours to an accuracy of 300 digits. Thats not an en-
- couraging result, folks, but remember it was my first program.
- The greatest difference to version three was, that in one byte
- only one decimal digit was contained. I had the double memory usage
- and I had to correct each ten-overflow `manually`.
- The pi-calculation-routine used a different formula that worked
- with squareroots, therefore the long computing time.
-
- ADAM_V2 :
- Version #2 is just an improved #1 version. Between these two
- there was time of six months, in these months I wrote my MANDEL-
- program an lerned of course a lot about the 68000.
- So in version #2 I only optimized the code and wrote a new
- pi-calculaton-routine which I copied nearly unchanged to version #3.
- This routine calculated pi in 3 hours to 1100 digits. (Consider
- the improvement to version #1 !!!)
-
- ADAM_V3 :
- For the latest version I wrote all basic calculation routines
- nearly completely new. The number format is now bcd-coding which
- is fast because I can use the abcd- and sbcd-commands of the 68000.
- I added the routines fakultaet and sinus. This version put out
- 3240 digits of pi in 2 1/2 hours.
-
- Survey of calcultion speeds (in seconds) :
-
- vst=400
- nst=600
- | sqr(45) | quadrat(sqr(45)
- ----------------+---------------+------------------
- ADAM_V1: | 68.2 | 18.0
- ----------------+---------------+------------------
- ADAM_V2: | 57.0 | 17.0
- ----------------+---------------+------------------
- ADAM_V3: | 11.0 | 1.0
-
-
- Today : 6. 6. `93
-
- Me :
- For bugs and other reports, suggestions write to :
-
- Michael Lorek
- Fichtenweg 21
- 27726 Worpswede
- GERMANY
-