Search Top Index

HELP DECIMALS Mark Rubinstein, December 1984, A.S. Oct 1986 For a tutorial introduction to the different kinds of numbers that POPLOG recognises and uses see TEACH DECIMALS. POPLOG has several kinds of numbers - integers, bigintegers, decimals ("reals") double decimals (called "ddecimals" in POPLOG) complex numbers ratios *DDECIMAL numbers are more accurate (contain more significant digits) than DECIMAL numbers. The other side of the coin is that POPLOG has to use more memory to store them, and their use can cause additional "garbage collections". When a number is read (from a file or from the terminal) without a decimal point, an INTEGER is created. If a decimal point is read then a DDECIMAL is created. However if the result of a computation is a real number then POPLOG returns a DECIMAL number, e.g. dataword(1) => ** integer dataword(4.5) => ** ddecimal dataword(9/2) => ** decimal (See HELP *DATAWORD). POPLOG can be made to return DDECIMAL numbers by assigning TRUE to POPDPRECISION (see REF *POPDPRECISION). It is also possible to ensure that a number read in is either a single or double precision number, by using "s0" or "d0" at the end, e.g. dataword(1.0s0) => ** decimal dataword(1.0d0) => ** ddecimal An "exponent" notation is available for decimals using "e" followed by the power of 10 to be used: 3.123e3 => ** 3123.0 3.123e-3 => ** 0.003123 If, instead of "e" "s" is used, the number will be read as a SINGLE decimal number,e.g. 3.123s-3=> ** 0.003123 -- See also ------------------------------------------------------------ HELP *NUMBERS - on number datatypes in POP-11, and procedures which operate on them. REF *ITEMISE - on the workings of the itemiser, and textual representations of all POP-11 datatypes. HELP *PRINT - on the POP-11 printing mechanism. HELP *BIGINTEGERS - on bigintegers. REF *NUMBERS - technical overview of numbers and associated procedures. --- C.all/help/decimals ------------------------------------------------ --- Copyright University of Sussex 1987. All rights reserved. ----------