|
DataMuseum.dkPresents historical artifacts from the history of: RC4000/8000/9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC4000/8000/9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 15360 (0x3c00) Types: TextFile Names: »layoutinp«
└─⟦667bb35d6⟧ Bits:30007480 RC8000 Dump tape fra HCØ. └─⟦4334b4c0b⟧ └─⟦this⟧ »layoutinp«
<se *<*pl 297,10,285,9,4* *lw170**pn 0,1**ps0* *sb#,6* *fg100* *ct* External algol6 procedures *nl2* optimal layouts and nice-numbers *nl6* Rene Moss *nl15* *qr*June 1978 rapport 78-4 version 1979-1-26*rj* *pn 2,1**ps 30* This report describes 10 procedures to select, change, analyse , read and write layout strings and 4 procedures to change numbers to "nice numbers" and count the number of significant digits.*nl2**np* The general form of a layout is described in the algol6 user manual (RCSL 31-D322) 9.78 in connection with the procedure write.*np* The layout string consists of 48 bit (i.e. it can be stored in one real). and the correspondence between the possible layouts and the binary patterns is explained in the algol6 user manual 3.6.5. *nl2**np* The readprocedure "readlay" is described more detailed in the report of "conversional parameter input". *nl2**np* Some procedures (digits,exactlay,numbdigit,origor) uses the number of significant digit in a real, z. Due to the 36 bit represen- tation of z it can at most contain 11 digit (z<34359738367) or 10 digit (z<9999999999) but since z may contain rounding errors from preceding calculations the 11'th (or 10'th) digit is considered insignificant. *np* In these procedures reals are rounded to and manipulated as semi-long integers (RSCL 31-d322 3.1.7 and the reference manual RSCL 55-D1 5.7) as follows: *sj**se !* roundr:=2**34; z1,z2<=roundr a is semilong integer a:=z1+roundr-roundr; a<=z integer division: a:=z1/z2; a:=(if a>=0 then (a-0.5) else (a+0.5))+roundr-roundr; b:=-(-z-0.5-roundr+roundr); b>=z !se *!*rj**np* Note that write may introduce a rounding error in the 12'th digit so a semilong integer written with a 12 position layout having decimal point and exponent part seems not to be an integer. *nl5* The procedure ALGOL texts are in "layoutxt" while the description is in "layoutbskr". *ps0* *qr*1978-6-29 Rene Moss*rj**ct**nl4* real procedure approxnumb*rj**nl2* finds the nicest real approxnumb in the interval ze around z close to z (cfr. origor). approxnumb contains as few significant digits as possible. Less significant digit is preferably chosen to 5 if possible or even but else odd. *nl2* call: approxnumb(z,ze,b)*nl2**lm49* *mt 1, approxnumb (* return value, real).*nl2* *mt 1, z (* call value, real).*nl2* *mt 1, ze (* call value, real). ze<0 means absolute interval, ze>0 relative interval.*nl2* *mt 1, b (* return value, integer). The number of significant digits.*lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-6-20 Rene Moss*rj**ct**nl4* boolean procedure charlay*rj**nl2* Transforms a layout given in symbolic representation as a textstring (see algol6 user manual 9.78) to a layout string. Note that the layout cannot be read by readstring unless the alphabet is changed. This is done in readlay. *nl2* call: charlay(text,lay)*lm38**nl2* *mt 1, charlay (* return value, boolean). True if the text-layout fulfils the syntax for layouts. *nl2* *mt 1, text (* call value, array (1:11)). The symbolic representation of the layout as <<...> stored as characters in the array text. The maximal length is 62 characters. *nl2* *mt 1, lay (* return value, real). The real corresponding to the layout. *lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-6-26 Rene Moss*rj**ct**nl4* real procedure cutlay*rj**nl2* cuts a specified layout to give only b significant digits. The number of positions in the layout is unchanged. For a layout without exponent part the superfluous d's are changed to 0's from the right. For a layout with exponent part the d's in front of the point are first replaced by spaces except for the foremost d (z,f,b) and then eventually d's are changed to 0's from the right. The exponent part is left unchanged and so are the spaces in the layout. Preferably to be used for exponent layout without decimal point in connection with printing of data with different errors.*nl2* call: cutlay(lay,b) *nl2* *lm36* *mt 1, cutlay (* return value, real). A real corresponding to the selected layout. *nl2* *mt 1, lay (* call value, string). The layout to be changed. *nl2* *mt 1, b (* call value, integer). The number of significant digit required. If b exceeds the number of digit positions in lay or b<=0, lay is unchanged.*lm0* *nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr* 1978-6-29 Rene Moss*rj**ct**nl4* real procedure digits*rj**nl2* gives a real which contains all significant digits in z as a semi-long integer, i.e. z is multiplied by a suitable power of ten, which is returned in ze. The number of digits b <10 (<9 for digits<1000000000), i.e. the least significant 11'th (10'th) digit is regarded as insignificant.*nl2* call: digits(z,ze,b) *nl2* *lm36* *mt 1, digits (* return value, real). Contains all significant digits in z. *nl2* *mt 1, z (* call value, real). *nl2* *mt 1, ze (* *se !* return value, integer). digits=z*10**(-ze).!se *! *nl2* *mt 1, b (* return value, integer). The number of significant digits. *lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-6-9 Rene Moss*rj**ct**nl4* real procedure exactlay*rj**nl2* creates a layout with as few positions as possible to print all significant digits.(cfr. numbdigit)*nl2* call: exactlay(z,npos,zr) *lm41* *nl2* *mt 1, exactlay (* return value, real). A real corresponding to the selected layout. *nl2* *mt 1, z (* call value, real). The number for which a layout is found. *nl2* *mt 1, npos (* return value, integer). The number of positions in the selected layout. *nl2* *mt 1, zr (* return value, real). The number z (if z was given as an expression).*lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr* 1979-1-12 Rene Moss*rj**ct**nl4* real procedure fixexplay*rj**nl2* produce if possible a layout for printing a number z by modifying a layout lay for printing the number zref in such a way that the exponents are identical in value. The two layouts are identical except for the number of leading spaces and digitpositions in front of the point; that is the number of significant digits (and spaces) is changed to give a corresponding change in the exponent to ensure if possible a given value of the exponent or at least a value as close as possible. This is also the case for layouts without exponentpart but in this case the exponents are identical zero so a too large number will give an alarm layout when written with the produced layout. It is stressed that the layout may contain 0's which allready to some extend ensure a fixed exponent. In the special case that z is zero the resulting layout consists of spaces and one 0.*nl* The layout is constructed to give nice numbers on axis in drawings, but could be used in tables where the fixed exponent makes it easier to compare different numbers. *nl2* call: fixexplay(lay,zref,z,zr) *lm42**nl2* *mt 1, fixexplay (* return value, real). A real corresponding to the selected layout. *nl2* *mt 1, lay (* call value, real). The layout to be modified. *nl2* *mt 1, zref (* call value, real). The value of the exponent produced in writing zref with the layout lay should be fixed. *nl2* *mt 1, z (* call value, real). The number to be written with the modified layout. *nl2* *mt 1, zr (* return value, real). The number z (if z was given as an expression). *lm0**nl3* language: ALGOL *nl2* Maintenance level: user *ps0* *qr* 1978-6-7 Rene Moss *rj**ct**nl4* integer procedure laypos*rj**nl2* counts the number of positions used by the specified layout and the number of significant digit positions.*nl2* call: laypos(lay,b) *nl2* *lm36**mt 1, laypos (* return value, integer). The number of positions. *nl2* *mt 1, lay (* call value, string). The layout to be analysed. *nl2* *mt 1, b (* return value, integer). The number of significant digit positions.*lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-6-9 Rene Moss*rj**ct**nl4* real procedure minlay(r)*rj**nl2* creates a layout with as few positions as possible to print a number with a specified precision. The highest precision is 10 (9) digits. On RC4000 the name is minlayr. *nl2* call: minlay(z,errz,npos,zr) *lm38**nl2* *mt 1, minlay (* return value, real). A real corresponding to the selected layout. *nl2* *mt 1, z (* call value, real). The number for which a layout is found. *nl2* *mt 1, errz (* call value, real). The error which is accepted in the layout representation of z. if errz<0 then an absolute error else a relative error. *nl2* *mt 1, npos (* return value, integer). The number of positions in the selected layout. *nl2* *mt 1, zr (* return value, real). The number z (if z was given as an expression).*lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr* 1978-6-12 Rene Moss*rj**ct**nl4* integer procedure numbdigit*rj**nl2* delivers the number of significant digits and the least significant digit.*nl2* call: numbdigit(z,c,zr) *lm43**nl2* *mt 1, numbdigit (* return value, integer). The number of significant digits. The number of significant digits can never exceed 10 (for 1000000001<signf. digit<3435973836) else 9. This is one digit less than the representation precision for reals, but this last digit will usually be wrong due to rounding. *nl2* *mt 1, z (* call value, real). The number to be analyzed. *nl2* *mt 1, c (* return value, integer). The least significant digit. 1<c<9. *nl2* *mt 1, zr (* return value, real). The number z (if z was given as an expression).*lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-6-29 Rene Moss*rj**ct**nl4* real procedure origo(r)*rj**nl2* finds a nice real origo, zl<=origo<=zh close to zl (cfr. approxnumb). zl and zh are the numbers as they are represented. origo contains as few significant digits as possible. Less significant digit is preferably chosen to 5 if possible or even but else odd. On RC4000 the name is origor. *nl2* call: origo(zl,zh,zde) *lm36* *nl2* *mt 1, origo (* return value, real). The nice number. *nl2* *mt 1, zl (* call value, real). origo>zl. *nl2* *mt 1, zh (* call value, real). origo<zh. *nl2* *mt 1, zde (* *se !* return value, integer). origo*10**(-zde)!se *! is a natural number.*lm0* *nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-6-9 Rene Moss*rj**ct**nl4* boolean procedure packlay*rj**nl2* creates a layout with l leading spaces, h digit positions before the point, d positions after the point, b significant digit and s digit position in the exponent. The type of sign and first letter in the number-part and exponent-part if present must be specified.*nl2* call: packlay(l,b,h,d,s,type) *nl2* *lm38* *mt 1, packlay (* return value, real). A real corresponding to the layout. *nl2* *mt 1, l (* call value, integer). as explained above. l<23 *nl2* *mt 1, b (* as l). b<32 *nl2* *mt 1, h (* as l). h<16 *nl2* *mt 1, d (* as l). d<16 *nl2* *mt 1, s (* as l). If s=0 the exponent part is left out. s<4 *nl2* *mt 1, type (* call value, string). string of 2 or 5 characters to specify the layout type: *sj* 1. character: +/-/_ 2. - z/f/b/d 3. - ' 4. - +/-/_ 5. - z/f/d *rj**nl* *mt 1, lay (* return value,real). A real corresponding to the layout. *rj**lm0**nl3* Language: ALGOL*nl2* Maintenance level: user*ps0* *qr*1978-9-26 Rene Moss*rj**ct**nl4* real procedure readlay*nl3**rj* reads a layout in conversional mode. The text text is written on current output and a layout read from current input. In case that current input and current output are on different medium is the read layout repeated on current output. Only syntactic correct layouts in <<...> quotes followed by a NL character are accepted otherwise the reading is repeated. See also the description of "conversional parameter input". *nl2* call: readlay(text) *nl2**lm 38* *mt 1, readlay (* return value, real). A real corresponding to the layout read from current input. *nl2* *mt 1, text (* call value, string). The text to be written on current output. *nl3**lm 0* Language: ALGOL *nl2* Maintenance level: user *ps0* *qr*1978-6-9 Rene Moss*rj**ct**nl4* integer procedure splitlay*rj**nl2* interpretes a layout as number of positions etc. and creates a long textstring equal to the symbolic representation. The layout is assumed to be syntactic correct, otherwise a meaningless result is delivered.*nl2* call: splitlay(lay,l,b,h,d,s,CHARFORM) *nl2* *lm41* *mt 1, splitlay (* return value, integer). The number of positions used by the layout. *nl2* *mt 1, lay (* call and return value, real). The layout to be interpreted. At return the type see packlay. *nl2* *mt 1, l (* return value, integer). The number of leading spaces. *nl2* *mt 1, b (* as l). The number of significant digits. *nl2* *mt 1, h (* as l). The number of digits before the point. *nl2* *mt 1, d (* as l). The number of digits after the point. *nl2* *mt 1, s (* as l). The number of digits in the exponent. *nl2* *mt 1, CHARFORM (* return value, array (1:8)). A textstring which gives the symbolic representation.*lm0* *nl3* Language: ALGOL*nl2* Maintenance level: user *ps0**qr*1978-18-10 Rene Moss*rj**ct**nl4* procedure writelay*rj**nl2* writes a real corresponding to a layout on the zone z as the symbolic representation <<...>. *nl2* call: writelay(z,lay) *nl2**lm38* *mt 1, z (* call and return value, zone). Specifies the document, the buffering, and the position of the document (see ALGOL 6 manual 6.1). *nl2* *mt 1, lay (* call and return value, real). The layout to be written. *nl3**lm0* Language: ALGOL*nl2* Maintenance level: user *ef* ▶EOF◀