The Euclidean Division Implemented with a Floating-Point Division and a Floor
Résumé
We study conditions under which the Euclidean division can be implemented using a floating-point division followed by a floor function. We show that under reasonable assumptions, the rounding downward mode can always be used, and the rounding to nearest mode can be used in most practical cases. These results may be useful for any language, but there is a particular benefit for languages, like ECMAScript, that do not have an integer division and that always round to nearest. We also show that an intermediate extended precision can introduce errors and give a condition under which an extended precision has no effect on the results.
Loading...