Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 3 - Appendixes
Appendix B - Porting Programs to PowerPC Numerics


The Rules of Evaluation

Each computer uses different rules of evaluation. Here are three reasonable rules:

Rule 1 is instant rounding. It is the rule on computers having many registers the same width as memory. This rule has been used by IBM and CDC Fortran since 1963. It is not part of the Fortran standard, though it is often thought to be.

Rule 2 is what SANE does by evaluating in extended precision. Other machines using this approach include the PDP-11C (using double precision) and floating-point coprocessors such as the 8087 and the MC68881. This approach does not take best advantage of machines with separate processing units for each floating-point format.

Rule 3 is what PowerPC Numerics does and is the way you do it when computing by hand. It was the rule in Fortran until 1963. By this rule, if you see an expression with mixed precision, you assume the user wants the widest visible precision.

With PowerPC Numerics, you can write code to simulate any of these rules. To simulate rule 1, use separate assignments when computing subexpressions. To simulate rule 2, convert all operands to double-double format before performing an expression.

For transported code, either you have to understand the programmer's tricks or you have to mimic the way rounding works on the programmer's machine. With PowerPC Numerics, you can set the rounding direction to mimic other machines.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996