Modern Electronics (was Re: List charter mods & headcount... ;

From: Michael Sokolov <msokolov_at_ivan.Harhan.ORG>
Date: Fri Jun 25 10:47:11 2004

Paul Koning <pkoning_at_equallogic.com> wrote:

> Then there are special cases: the Cray and Alpha integer units, which
> don't offer divide at all. Instead, you're supposed to multiply by
> the reciprocal of the divisor.

Ahmm, but the reciprocal of an integer is not an integer, so you are
stepping out of integer-land into floating point territory. Do you
really want to use floating point to implement integer division
(dividing an integer by an integer to get quotient and remainder)?
And how do you guarantee that the final integer result will be exact?
(I guess you convert the dividend to a float, get the reciprocal of
the divisor, which will be a float, do float multiplication, and integerise
the result, right? Are there enough bits of precision in a float to
guarantee an exact result for integer division done this way? I
doubt that, since AFAIK Alpha has usual 32-bit and 64-bit floats,
which have other things besides mantissa in those bits, but has
64-bit integers.) And how do you get the remainder? Floating division
(whether direct or via multiplication by the reciprocal) doesn't produce
a remainder at all.

MS
Received on Fri Jun 25 2004 - 10:47:11 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:37:00 BST