###
CSCI-UA.0436 - Prof. Grishman

###
Lecture 9 - Arithmetic

(finsh discussion of carry look-ahead)

#### Multiplication (text, sec. 3.3)

- sequential multiplication
- basic algorithm is like decimal (long) multiplication
- keep a running total so we don't have to store so many numbers
- implement in hardware by using shift
registers (text, figure 3.4)
- basic algorithm ...

- repeat 32 times:
- if low bit of multiplier == 1, product += multiplicand
- shift multiplicand left one bit
- shift multiplier right one bit

- because multiplier shrinks while product grows, can keep both
in
a single register (text, figure 3.6)

- sequential multiplier is slow (N clock cycles for N bits)
- now, with availability of lots of gates, can build
combinatorial
multipliers which are much faster (text, page 235 ("faster
multiplication"))

#### Floating point representation (sec. 3.5, pp. 242-250)

- implements float and double types of Java and C
- 'scientific' representation: sign, exponent, and
coefficient (fraction)
- value is [sign] x coefficient x 2
^{exponent}

- normalized representation for maximum precision

- IEEE 754 standard

- float: 8 bit exponent, 23 bit fraction, sign bit

- double: 11 bit exponent, 52 bit fraction, sign bit

- need for high precision
- loss of precision through repeated addition