Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

An equivalent for Divide by 3

Status
Not open for further replies.

sheikh

Advanced Member level 4
Full Member level 1
Joined
Sep 10, 2007
Messages
104
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
2,008
Hello Dears
As you know we can use Shift unit for divide by 2 (or multiply by 0.5). Now please tell me is there any way to calculate Divide by (3) or (5) without using a divider? (I mean substitute divider unit by another unit, Shift for instance!)
Regards
Mostafa
 

Yes you could shift to divide by 3, but your number would have to be in trinary, not binary.
A similar type of thing applies for dividing by 5.
If you think about it, when you divide by 10 in decimal, you are mentally shifting the digits too.
Most computers however are binary..
 
  • Like
Reactions: sheikh

    sheikh

    Points: 2
    Helpful Answer Positive Rating
You can also use a multiplier for division, but you must specify the required precision.

1/3 would be 0.0101010101010101.... It has no finite length value in base 2, just as it has no finite length value in base 10 (0.3333...)

to divide by 3, you can multiply by "00101011", and then shift the result by 7 places. eg: "1111"*"00101011" = 5.

the rounding is a bit odd -- if "00101010" is used instead, then the above would be 4. in the end, the length of "1/3" should be based on the precision. for example if 3000 is used with the above method, the result would be 1007. if you only care about the result to within +-8, that would be ok.

Also, note that there is no reason to keep precision to an integer place, you can keep the extra fractional bits.

larger divisors will require larger multiplicands for the same level of precision. 1/3 is far from 1/4 or 1/2, but 1/3000 is close to 1/3001.
 
  • Like
Reactions: sheikh

    sheikh

    Points: 2
    Helpful Answer Positive Rating
Thanks Dear Permute
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top