PDF

Description

Ada implementations have the option of supporting fixed-point arithmetic with arbitrary scale -- that is, in which the safe numbers are of the form m-sigma for a fixed, arbitrary rational sigma > 0, with m in some contiguous range of integers. The major difficulty with providing such support is the implementation of the mixed-type operations, multiplication and division. If x and y are the integer values representing the operands, these operations reduce to finding integer approximations of alphaxy or betax/y with an absolute error less than 1 for a fixed-point result type, an absolute error less than or equal to 1/2 for an integer result type, or a relative error of less than one safe interval for a floating-point result type. The static constants alpha and beta may be arbitrary positive rational numbers, depending on the scales of the two operand types and on the result type. I present reasonably fast ways to compute appropriate fixed-point results for all values of alpha or beta. For integer result types, I give algorithms for alpha and beta that have the form 2^ma/b, where a and b are positive, single-precision integer constants. Finally, I give algorithms to produce floating-point results for a variety of architectures, including the VAX, the IBM 370, and those conforming to IEEE 754.

Details

Files

Statistics

from
to
Export
Download Full History