Solved

Posted on 2009-05-01

i am trying to divide 50 by 23 . These are unsigned 6-bit integers.

50 = 00110010

23 = 00010111

since numbers are 6 bits there are 7 steps.

after the 6th step R=R-D since result is not negative remainder becomes 000100 and

quotient = 0001 , divisor - 101110 (before shifted to right). I don't know what to do next

I'm not sure whether i am doing it right way. Can someone explain this?

Thanks

50 = 00110010

23 = 00010111

since numbers are 6 bits there are 7 steps.

after the 6th step R=R-D since result is not negative remainder becomes 000100 and

quotient = 0001 , divisor - 101110 (before shifted to right). I don't know what to do next

I'm not sure whether i am doing it right way. Can someone explain this?

Thanks

5 Comments

http://books.google.com/bo

Compare the example in the text book on page 186: the 4 bit divisor is scaled by shifting it left 4 bits initially.

```
Wrong:
=====
At START: R = 00110010 D = 00010111 Q = 00000000
After 1: R = 00011011 D = 00010111 Q = 00000000
After 2a: R = 00011011 D = 00010111 Q = 00000001
After 3: R = 00011011 D = 00001011 Q = 00000001
After 1: R = 00010000 D = 00001011 Q = 00000001
After 2a: R = 00010000 D = 00001011 Q = 00000011
After 3: R = 00010000 D = 00000101 Q = 00000011
After 1: R = 00001011 D = 00000101 Q = 00000011
After 2a: R = 00001011 D = 00000101 Q = 00000111
After 3: R = 00001011 D = 00000010 Q = 00000111
After 1: R = 00001001 D = 00000010 Q = 00000111
After 2a: R = 00001001 D = 00000010 Q = 00001111
After 3: R = 00001001 D = 00000001 Q = 00001111
After 1: R = 00001000 D = 00000001 Q = 00001111
After 2a: R = 00001000 D = 00000001 Q = 00011111
After 3: R = 00001000 D = 00000000 Q = 00011111
After 1: R = 00001000 D = 00000000 Q = 00011111
After 2a: R = 00001000 D = 00000000 Q = 00111111
After 3: R = 00001000 D = 00000000 Q = 00111111
After 1: R = 00001000 D = 00000000 Q = 00111111
After 2a: R = 00001000 D = 00000000 Q = 01111111
After 3: R = 00001000 D = 00000000 Q = 01111111
After 1: R = 00001000 D = 00000000 Q = 01111111
After 2a: R = 00001000 D = 00000000 Q = 11111111
After 3: R = 00001000 D = 00000000 Q = 11111111
Hence the result of the program is:
"50 / 23 is -1 remainder 8" -- not very promising
RIGHT:
=====
At START: R = 000000 110010 D = 010111 000000 Q = 000000 000000
first round:
After 1: R < 0
After 2b: R = 110010 D = 010111 000000 Q = 000000
After 3: R = 110010 D = 001011 100000 Q = 000000
second round:
After 1: R < 0
...
After 3: R = 110010 D = 000000 101110 Q = 000000
sixth round:
After 1: R = 000100 D = 000000 101110 Q = 000000
After 2a: R = 000100 D = 101110 Q = 000001
After 3: R = 000100 D = 010111 Q = 000001
seventh round:
After 1: R < 0
After 2b: R = 000100 D = 010111 Q = 000010
After 3: R = 000100 D = 001011 Q = 000010
END
Now the result is "50 / 23 is 2 remainder 4" as expected
```

By clicking you are agreeing to Experts Exchange's Terms of Use.

Title | # Comments | Views | Activity |
---|---|---|---|

Maths - Delta Query | 6 | 216 | |

proximity to a location polygon (Geozone) | 1 | 154 | |

How to update multiple binary circular files in C | 3 | 213 | |

My 2003 Land Rover discovery 2 key for code for car alarm | 7 | 55 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**18** Experts available now in Live!