home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d999 / adam.lha / ADAM / ADAM_v3.doc < prev    next >
Text File  |  1994-04-05  |  10KB  |  290 lines

  1.  
  2.  
  3.  
  4.         **********************************************
  5.         ***************** ADAM_V3 ********************
  6.         ************ calculation-program *************
  7.         *************** documentation ****************
  8.         **********************************************
  9.  
  10.  
  11.  
  12. Introduction :
  13.  
  14.       ADAM_V3 is the third version of a calculation program that is able
  15.     to calculate numbers to a length of some thousand digits before
  16.     and after the decimal point.
  17.       The program needs no disk-resident libraries, only the file `pidat`
  18.     should be in the same directory as ADAM_V3 (Otherwise the program
  19.     shows an errormessage and you can only use 8 digits of pi).
  20.  
  21. Starting ADAM_V3 :
  22.  
  23.       To start the program either doubleclick on the icon or type
  24.     `adam_v3_600` in the cli but be shure the current directory is
  25.     the directory the program is in.
  26.       When you start from the icon the commands "iconx" and "run" must
  27.     be in the c: directory.
  28.       The program opens a window and displays the main menu.
  29.  
  30. How to use ADAM_V3 ---- The Main Menu :
  31.  
  32.       From the main menu you get to the two branches of the program
  33.     and you can leave it here with `f1`.
  34.  
  35.       By pressing `f2` you get to the `calculation part` where you can
  36.     type numbers in and calculate with them, like on a pocket calculator.
  37.       You can now type in a number (or many numbers !), press <ENTER>
  38.     and type for example `*`, press <ENTER> again and type the second
  39.     number and then the result is printed. Then you can press
  40.  
  41.         f1  for the main menu
  42.         f2  to calculate again
  43.         f3  to calculate again with your result as first number
  44.         f4  to change the printing format
  45.             when the format is `formatted` the numbers after
  46.             the decimal point are printed in columns.
  47.         f5  to copy your result to the memory and calculate again
  48.         f6  to display the heltext (same as in the main menu)
  49.  
  50.       Pressing `f3` starts the pi-calculation-routine. At the beginning
  51.     the count of iterations is requested (e.g 30). Then the calculation
  52.     starts. It can be interrupted by pressing the left mousebutton.
  53.       Then you can save the result to a file.
  54.  
  55.  
  56.       `f4` shows the helptext that explains in detail the typing in
  57.     of numbers and displays all commands.
  58.  
  59.       Whith `f5` you can change the language from English to German and
  60.     vice versa. Default is English.
  61.  
  62. Sorry :
  63.  
  64.       I tried to prevent my program from crashing caused by user entries
  65.     (it detects various errors e.g. division by 0 and others) but
  66.     you can never be shure ... At least my program has never crashed
  67.     in this version on my Amiga500.
  68.  
  69.       There are two versions of my program. The one called    `ADAM_V3_600`
  70.     has 300 digits before and as many after the decimal point and the
  71.     other one `ADAM_V3_1400` has 700 before and 700 after it.
  72.  
  73. Copyright :
  74.  
  75.       This programm is published as public domain. That means you can
  76.     make use of the program and the sourcecode as you like whithout ANY
  77.     restrictions. My only request : When you copy the program to your
  78.     friends you should copy ALL files in the directory.
  79.  
  80.  
  81. ************************************************************************
  82.  
  83.  
  84. Some internal information :
  85.  
  86.       The following part tells about the structure of ADAM and is
  87.     probably only interesting for other programmers.
  88.       The program was written on the SEKAV3.0 assembler and is my third
  89.     (and probably last) version of a program that was intended to be
  90.     able to calculate numbers of ANY length before and after the
  91.     decimal point. That was soon limited most gravely by the 68000
  92.     processor`s 7 MHz speed. It should be no problem to assemble
  93.     it whith any other assembler because it uses no include files.
  94.       The (german) sourcecode is included in the file `ADAM_V3.source`.
  95.  
  96. About the arrays of numbers :
  97.  
  98.       Each number is represented completely in the fixed point array,
  99.     i.e. the exponential representation (3.45 * 10^67) is not possible.
  100.       The number is coded in bcd-technique, that means each byte holds
  101.     two decimal digits.
  102.        The size of the number can be varied seperately for the pre- and
  103.     post- decimalpoint-part. It is defined as a constant in the
  104.     sourcecode, i.e. it cannot be changed by the program but
  105.     it must be newly assemled. In the constant declaration at the
  106.     beginning of the sourcecode are the two most important variables:
  107.  
  108.     e.g.    vst=200
  109.         nst=300
  110.  
  111.       vst is the number of dezimal digits before the decimal point and
  112.     nst the number of digits after it. Both numbers must be dividable
  113.     by 4 without rest !!!.
  114.  
  115. Structure of a number array :
  116.  
  117.       As I said each byte holds two dezimal digits, so the first
  118.     vst+nst/2 bytes of an array hold the number digits. The following
  119.     ten bytes contain some information about the number.
  120.       After the constant definition for vst ( VorkommaSTellen) and
  121.     nst ( NachkommaSTellen ) there are three other constants:
  122.  
  123.     st1=sb+2
  124.     st2=sb+4
  125.     st3=sb+6
  126.  
  127.       sb is vst+nst/2 i.e. the binary length of the number. Supposing 
  128.     in a0 the basic adress of the array then in st1(a0) is the number
  129.     of decimal digits before the decimal point, in st2(a0) is the
  130.     number of decimal digits after the decimal point and in st3(a0)
  131.     is the sign (1 = 0, 2 = +, 3 = -).
  132.  
  133.       An example :
  134.     vst=8
  135.     nst=8
  136.     number : 67.038
  137.     representation in the array :
  138.  
  139.     00 00 00 67 03 80 00 00 00 00 00 02 00 03 00 02
  140.  
  141.     The number 0 is represented as
  142.  
  143.     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
  144.  
  145.       In the sourcecode each array is only a longword that holds the
  146.     basic adress of the array. If you need more variables you have
  147.     to put them in in the `allocmemory` routine.
  148.  
  149. Accuracy :
  150.  
  151.       The basic mathematical routines ( +, -, *, / ) are exact to the
  152.     last digit ( at division and multiplikation the last digit is
  153.     rounded). There can only problems with repeated square-rooting
  154.     because of addition of inaccuracies.
  155.  
  156. The calculation routines :
  157.  
  158.     unsigned :
  159.     plusu, minusu, veru, feldloesch, kopieren, tausch
  160.  
  161.     signed :
  162.     pluss, minuss, mals, div, vers
  163.  
  164.     and :
  165.     sqrroot :    squareroots a number
  166.     fakultaet :    faculty
  167.     quadrat :    square
  168.     integer :    deletes the part after the decimal point
  169.     sinus :        sinus function
  170.  
  171.     zahlein :    reads a number
  172.     druck :        prints a number
  173.     alldruck :    prints all bytes of an array (like a hex-dump)
  174.  
  175. Errors :
  176.  
  177. These errors do not display a message :
  178.  
  179.     - window could not be opened
  180.     - not enough memory
  181.  
  182. After one of these error has been recognized it is reported on the screen
  183. and the prorgram continues whith the main menu.
  184.  
  185.     - vst or nst are irregular (program ends)
  186.     - division by zero
  187.     - error in signword (when you have a wrong basic adress for an
  188.       array). This error does usually not occur when you work whith
  189.       the program. It can happen when you write your own calculation
  190.       routines.
  191.     - squareroot of a negative number
  192.     - overflow at addition, multplikation and division
  193.     - error at faculty
  194.  
  195. Calculation of pi :
  196.  
  197.       As an example for the use of my calculation routines I have
  198.     writte a routine that calculates pi with the arcustangens series
  199.     by Machin :
  200.  
  201.     pi = 4 * ( 4*arctan(1/5) - arctan(1/239) )
  202.  
  203.     arctan(x) = x  -  x^3/3  +  x^5/5  -  x^7/7  +  x^9/9  ...
  204.  
  205.       After each iteration pi gets roughly one decimal digit more
  206.     arrurate.
  207.  
  208.     Speed :
  209.       When you have small numbers (to about 400/1000) you can follow
  210.     the development very well, but with increasing nst you can go
  211.     to a concert while your computer calculates like mad and still
  212.     does not get ahead.
  213.       It takes some time to print the result of each iteration to
  214.     screen so I included the possibility to let it run without
  215.     printing. You can achieve this by typing `q` after you have inter-
  216.     rupted the calculation with the left ratbutton ( I admitted the
  217.     right shiftkey too because my left mousebutton is fucked up).
  218.     You can make the program print the result again by interrupting
  219.     it again and typing `q`.
  220.  
  221. Accuracy in calculating pi :
  222.  
  223.       When you let the program run with nst=600 you get 597 digits
  224.     of pi. You can extend this to longer numbers.
  225.  
  226.       In one run I had following data:
  227.     vst=400
  228.     nst=3300
  229.       After a time of roughly 2 1/2 hours the result was accurate to
  230.     3240 digits.
  231.  
  232. Name of the program :
  233.  
  234.       Why does this weird German programmer call his work ADAM ?
  235.     I tell you here :    1. It was my first BIG machine code program
  236.                 2. It is a reference to ADAM RIESE who intro-
  237.                    duced calculating with arabic numbers
  238.                    in the DARK Middle ages
  239.  
  240. Earlier versions :
  241.  
  242.     ADAM_V1 :
  243.       The first, slowest version, calculated pi in a time of about
  244.     24 (24 !!!) hours to an accuracy of 300 digits. Thats not an en-
  245.     couraging result, folks, but remember it was my first program.
  246.       The greatest difference to version three was, that in one byte
  247.     only one decimal digit was contained. I had the double memory usage
  248.     and I had to correct each ten-overflow `manually`.
  249.      The pi-calculation-routine used a different formula that worked
  250.     with squareroots, therefore the long computing time.
  251.  
  252.     ADAM_V2 :
  253.       Version #2 is just an improved #1 version. Between these two
  254.     there was time of six months, in these months I wrote my MANDEL-
  255.     program an lerned of course a lot about the 68000.
  256.       So in version #2 I only optimized the code and wrote a new
  257.     pi-calculaton-routine which I copied nearly unchanged to version #3.
  258.       This routine calculated pi in 3 hours to 1100 digits. (Consider
  259.     the improvement to version #1 !!!)
  260.  
  261.     ADAM_V3 :
  262.       For the latest version I wrote all basic calculation routines
  263.     nearly completely new. The number format is now bcd-coding which
  264.     is fast because I can use the abcd- and sbcd-commands of the 68000.
  265.       I added the routines fakultaet and sinus. This version put out
  266.     3240 digits of pi in 2 1/2 hours.
  267.  
  268.     Survey of calcultion speeds (in seconds) :
  269.  
  270.     vst=400
  271.     nst=600
  272.             |  sqr(45)    |  quadrat(sqr(45)
  273.     ----------------+---------------+------------------
  274.     ADAM_V1:    |  68.2        |  18.0
  275.     ----------------+---------------+------------------
  276.     ADAM_V2:    |  57.0        |  17.0
  277.     ----------------+---------------+------------------
  278.     ADAM_V3:    |  11.0        |  1.0
  279.  
  280.  
  281. Today :        6. 6. `93
  282.  
  283. Me :
  284.       For bugs and other reports, suggestions write to :
  285.  
  286.              Michael Lorek
  287.              Fichtenweg 21
  288.             27726  Worpswede
  289.                 GERMANY
  290.