# CS 0447 Lecture 22: Division and Floating-Point Representation

Division and Floating-Point Representation

- div = how many times can you subtract B from A to get number less than B

- How to binary divde:v

divisor shifted by (n-1)

then check if it fits

if y -> 1

if n -> 0

Considered done when bit sizes of q and dividend are equal

for (n bits in dividend){

quotient << = 1

dividend shifted by right 1 and top bit (of dividend) goes into remainder

if (dividor <= remainder){

}

}

div t0, a0

remainder = HI

quotient = LO

we use mfhi/ mflo to get answers

EXAMPLE:

divisor remainder dividend quotient

101 1011 0

1 0110 0'

- Divide circuit is closely related to multiplier

Biased Notation:

signed number and add a constant

in single precision floats our constant is 127

-127 => 0

signed => biased

find more resources at oneclass.com

find more resources at oneclass.com