next up previous contents
Next: Miscellaneous operations on Up: CHAPTER.5: NUMERICAL AND Previous: Illustrating popradians

Other global variables controlling arithmetical computations

popdprecision

The value of this variable controls the production of results from floating-point computations, in combination with the types of the arguments supplied to the relevant procedure. If it is false then only decimals (single precision floats) are produced. If it is the word "ddecimal" then ddecimal results are produced by arithmetic operators only if at least one of the arguments is ddecimal. If the value is anything else (e.g. true), then a ddecimal result can be forced if at least one of the arguments is integral or rational, even if the others are all decimals.

In NO case is there an increase in precision of floating point computations if all arguments are single-float decimal to start with. The default value of popdprecision is false.

Examples:

Case 1: Only single precision results

    false -> popdprecision;

    dataword(sqrt(3.5d0)) =>
    ** decimal

    dataword(sqrt(3.5s0)) =>
    ** decimal

    dataword(3.5d0 + 3.5s0) =>
    ** decimal

    dataword(sqrt(2)) =>
    ** decimal

Case 2: Double precision whenever a ddecimal is involved initially

    "ddecimal"-> popdprecision;

    dataword(sqrt(3.5d0)) =>
    ** ddecimal

    dataword(sqrt(3.5s0)) =>
    ** decimal

    dataword(3.5d0 + 3.5s0) =>
    ** ddecimal

    dataword(sqrt(2)) =>
    ** decimal

Case 3: Double precision produced if either ddecimal or non-decimal
    number is involved initially.

    true -> popdprecision

    dataword(sqrt(3.5d0)) =>
    ** ddecimal

    dataword(sqrt(3.5s0)) =>
    ** decimal

    dataword(3.5d0 + 3.5s0) =>
    ** ddecimal

    dataword(sqrt(2)) =>
    ** ddecimal
This means that if popdprecision is non false, then the evaluation of arithmetical expressions in which intermediate floating point numbers are produced will sometimes create temporary ddecimal numbers that are then discarded. As these are compound items (explained above) this can cause garbage collections, leading to reduced speed, the price of greater accuracy.

pop_reduce_ratios

This is normally true. Making it false prevents Pop-11's normal behaviour in which a ratio result is always reduced to its lowest common terms (and therefore to an integral result if the denominator becomes 1).



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998