Inexactness and Correction of Floating-Point Reciprocal, Division and Square Root
Abstract
Floating-point arithmetic performance determines the overall performance of
important applications, from graphics to AI. Meeting the IEEE-754 specification
for floating-point requires that final results of addition, subtraction,
multiplication, division, and square root are correctly rounded based on the
user-selected rounding mode. A frustrating fact for implementers is that naive
rounding methods will not produce correctly rounded results even when
intermediate results with greater accuracy and precision are available. In
contrast, our novel algorithm can correct approximations of reciprocal,
division and square root, even ones with slightly lower than target precision.
In this paper, we present a family of algorithms that can both increase the
accuracy (and potentially the precision) of an estimate and correctly round it
according to all binary IEEE-754 rounding modes. We explain how it may be
efficiently implemented in hardware, and for completeness, we present proofs
that it is not necessary to include equality tests associated with
round-to-nearest-even mode for reciprocal, division and square root functions,
because it is impossible for input(s) in a given precision to have exact
answers exactly midway between representable floating-point numbers in that
precision. In fact, our simpler proofs are sometimes stronger.