Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Assembly division

  1. Jun 12, 2005 #1
    First of all i'de like to know if there is an efficiant algorithm which assembly uses to divide two numbers.
    Second I'de like to know how do you divide numbers which don't fit into a register. I'm talking about an array of bytes in RAM to be divided.

    10x!
     
  2. jcsd
  3. Jun 12, 2005 #2

    saltydog

    User Avatar
    Science Advisor
    Homework Helper

    Well, you could use multi-precision arithmetic if it's really large numbers or very high precision. I tell you what though, that would be quite a neat challenge in assembly. What about just C++? You know that's pretty close to assembly speed. Anyway, just search the web for "multi-precision arithmetic". The algorithm is straight-forward and intuitive once you work with it for a while.

    As far as what assembly does, 2's compliments come to mind but I'd really have to review on that one.
     
  4. Jun 12, 2005 #3

    dduardo

    User Avatar
    Staff Emeritus

    In ASM you can do integer division by using DIV. If you want to do floating point division use FDIV.

    Here is a C library for doing arbitrary precision arithmetic:

    http://www.swox.com/gmp/index.orig.html

    There are more specialized libraries depending on how many bits of precision you really need. This is just a general case library.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Assembly division
  1. Assembly tutorials (Replies: 2)

Loading...