piclist 1999\10\29\221953a >
Thread: Division and Multiply of Binary #'s
face BY : Chris Fanning email (remove spam text)

>     How do you Divide two binary numbers
> "long division"
> Say you have   1234 / 6.  Long division says:
>            _______
>         6 / 1234      2
>             12
>              03       0
>              00
>               34      5
>               30
>                4

Yes, this works.  But how about for negative numbers?

There's a slow algorithm in text books that's very applicable here.  And
when I say slow, I mean it's 1 "operation" per bit.  (You can do better.)
It's just about as much work as the algorithm described above and works
for all values.  Perfect for a PIC which has adds and subtracts with the
exception that the registers are only 8-bits.

I used it for an IEEE 754 divider in Verilog.  If anyone wants I'll
dig up the references.  It came from a horribly well known book which
I can't remember the title of at the moment.

It'd be really easy for me to replace a $1.50 PIC with a $90 FPGA.. :)


<199910300218.WAA85158@jingoro.prevmed.sunysb.edu> 7bit

In reply to: <CMM.> from William Chops Westfield at "Oct 29, 1999 11:35: 7 am"
See also: www.piclist.com/techref/method/math.htm?key=multiply
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Division and Multiply of Binary #'s

month overview.

new search...