home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol133 / flptpack.doc < prev    next >
Encoding:
Text File  |  1984-04-29  |  6.1 KB  |  171 lines

  1.         EXTENDED PRECISION FLOATING POINT PACKAGE
  2.                 UTILISATION NOTES
  3.  
  4.  
  5. 1. Introduction
  6.  
  7.     The Extended Precision Floating Point Package deals with extended
  8.    precision reals represented by the following type :
  9.     
  10.             newreal = record
  11.                   s  :  signtype;
  12.                   f  :  fraction;
  13.                     e  :  byte
  14.                   end;
  15.  
  16.    in which s is the sign, f is the fraction or mantissa and e is the
  17.    characteristic or biased exponent of the real.
  18.  
  19.     In the above :
  20.             signtype = (plus, minus);
  21.             fraction = array[0..n] of byte;
  22.             byte     = 0..255.
  23.  
  24.     It is further assumed that :
  25.  
  26.          the byte of index 0 of the array representing the fraction
  27.          has always value zero;
  28.          the "point" always preceeds the byte of index 1 of the array
  29.          representing the fraction.
  30.  
  31.        The above representation is quite efficient in terms of memory
  32.     utilisation and speed but it must be converted to a more suitable
  33.     notation.
  34.  
  35.     For this reason the Extended Precision Floating Point Package
  36.     includes conversion procedures allowing the extended precision reals
  37.     to be represented in the customary scientific notation.  Thus they
  38.     are displayed as  a  signed string  of  decimal digits followed by
  39.     'E' and by an exponent as in the PASCAL/Z representation of the type
  40.     real.
  41.     Similarly, extended precision reals are inputted as signed or unsigned
  42.     strings of consecutive decimal digits optionally followed by an 'E'
  43.     or 'e' and an exponent following the customary scientific notation.
  44.  
  45.     The value of n, that is the number of significant "digits" available
  46.     in the internal representation of the extended precision reals, has
  47.     been presently set equal to 6. This value can however be modified at
  48.     will by altering the constants in FLPTCONS.PAS (see later). Most of
  49.     the presently available procedures and functions maintain their
  50.     validity for any value of n.
  51.     As a warning against possible erroneous results, specific comments
  52.     have been provided whenever a procedure or a function is valid only
  53.     for specified values of n.
  54.  
  55.     Presently the Extended Precision Floating Point Package consists
  56.     of only one module designated as BASICOPS (for BASIC OPERATIONS) 
  57.     allowing the following calls from a main program :
  58.  
  59.         function absol(u : newreal) : newreal;
  60.         function isequal(u, v : newreal) : boolean;
  61.         function isgreater(u, v : newreal) : boolean;
  62.         function islower(u, v : newreal) : boolean;
  63.         function iseqgreat(u, v : newreal) : boolean;
  64.         function iseqlower(u, v : newreal) : boolean;
  65.         function add(u, v : newreal) : newreal;
  66.         function sub(u, v : newreal) : newreal;
  67.         function multp(u, v : newreal) : newreal;
  68.         function divde(u, v : newreal) : newreal;
  69.         function modu(u,v : newreal) : newreal;
  70.         procedure do_read(var u : extdatum; var v : newreal);
  71.         procedure do_write(u : newreal).
  72.  
  73.     The function absol generates the absolute value of the argument.
  74.  
  75.     The five boolean functions which follow are the equivalent of the
  76.     standard comparison operators.
  77.  
  78.     The next five functions are respectively the sum, the difference,
  79.     the product, the quotient and the modulo of two extended precision
  80.     reals.
  81.  
  82.     The procedure do_read reads an extended precision real expressed in
  83.     standard scientific notation and converts it to the internal represen-
  84.     tation.
  85.  
  86.     The procedure do_write converts an extended precision real from the
  87.     internal representation to scientific notation and displays it.
  88.  
  89.     The Extended Precision Floating Point Package will be expanded
  90.     to include additional modules covering all standard operations and
  91.     functions with reals.
  92.  
  93.  
  94.  
  95. 2. RUNNING A PROGRAM WITH EXTENDED PRECISION REALS
  96.  
  97.     To utilize the function and procedures of the Extended Precision
  98.     Floating Point Package the main program must include :
  99.  
  100.         the constants in the file FLPTCONS.PAS;
  101.         the types in the file FLPTTYPE.PAS;
  102.         the variables in the file FLPTVAR.PAS;
  103.         the external procedures and functions in FLPTEXT.PAS
  104.  
  105.     in addition to the declarations which are specific to the main
  106.     program.
  107.  
  108.     The file BASICOPS.PAS is conceived as a module to be compiled
  109.     and assembled separately and then linked to the main program.
  110.  
  111.     The file FLPTEXT.PAS comprises the list of all functions and
  112.     procedures in BASICOPS.PAS which may be called from the main
  113.     program and, in addition, the external routines (in assembler)
  114.     called by BASICOPS.PAS. Such routines are contained in the files
  115.     BYTEOPS.SRC and BYTEOPS.REL and need to be linked to the main 
  116.     program as well.
  117.  
  118.     In summary the following command sequence would be required :
  119.  
  120.             PASCAL48 <MAINPROGRAM>.AAAA
  121.             ASMBL MAIN,<MAINPROGRAM>/REL
  122.             PASCAL48 BASICOPS.AAAA
  123.             ASMBL EMAIN,BASICOPS/REL
  124.             ASMBL EMAIN,BYTEOPS/REL
  125.     LINK /N:<MAINPROGRAM> <MAINPROGRAM> BASICOPS BYTEOPS /E.
  126.  
  127.     It should be further noted that each operation performed by
  128.     the Extended Precision Floating Point Package can be executed in one
  129.     of two modes : the TRUNCATED mode or the ROUNDED mode. The required
  130.     mode must be set by the main program with one of the following
  131.     statements :
  132.  
  133.             mode := rounded;
  134.             mode := truncated;
  135.     
  136.     The variable mode is contained in FLPTVAR.PAS.
  137.  
  138.  
  139. 3. DEMONSTRATION PROGRAM
  140.  
  141.     The files FLPTDEMO.PAS and FLPTDEMO.COM allow a program using
  142.     the Extended Precision Floating Point Package to be run for the purpose
  143.     of demonstration and familiarisation.
  144.     
  145.     TO RUN THE PROGRAM IT IS SUFFICIENT TO INPUT FLPTDEMO AND THEN
  146.     follow the step-by-step instructions.
  147.  
  148.         One should exerce a certain care in inputting data as the program
  149.     is not entirely protected against misleading inputs. For this reason
  150.     all input data are echoed to the terminal as they are actually read 
  151.     by the program and should be checked for consistency with respect to
  152.     the intended inputs.
  153.  
  154.     It should be emphasized that a significant proportion of the time
  155.     required to run the program is absorbed by the relatively slow input
  156.     and output conversion routines.
  157.  
  158.  
  159.  
  160.  
  161.  
  162. 4. ..... AND LASTLY
  163.     Any suggestions for improvement and/or requests for clarification
  164.     will be welcomed.
  165.                     
  166.                     Lanfranco EMILIANI
  167.                     Maurits de Brauwweg 11
  168.                     2597-KD Den Haag
  169.                     The Netherlands
  170.  
  171.