Assembly Divisions: Algorithms & #s Not Fitting Registers

In summary, there are efficient algorithms for dividing large or precise numbers in assembly, such as using multi-precision arithmetic. For integer division, the DIV instruction can be used, while FDIV is used for floating point division. There are also libraries available for doing arbitrary precision arithmetic in C.
  • #1
mtanti
172
0
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!
 
Computer science news on Phys.org
  • #2
mtanti said:
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!

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.
 
  • #3
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.
 
Last edited by a moderator:

1. What are assembly divisions?

Assembly divisions refer to the process of breaking down a larger problem or task into smaller, more manageable subtasks. In the context of algorithms and registers, this often involves dividing a large data set or problem into smaller pieces that can be processed by the computer.

2. Why are algorithms and registers not fitting?

Algorithms and registers may not fit due to limitations in the size and capacity of the registers, which are small storage areas within the computer's CPU. This can occur when the data being processed is too large or complex to fit into the available registers, requiring additional steps or modifications to the algorithm.

3. What is the role of algorithms in assembly divisions?

Algorithms play a critical role in assembly divisions by providing a systematic approach to breaking down a problem or data set into smaller, more manageable parts. They help ensure that the divisions are done in a logical and efficient manner, allowing for the data to be processed and stored in the registers effectively.

4. How do assembly divisions affect the performance of a computer?

Assembly divisions can impact the performance of a computer by requiring additional steps or operations to be performed in order to fit the data into the registers. This can slow down the processing speed and overall performance of the computer, especially if the data set is particularly large or complex.

5. Are there any alternative methods to assembly divisions?

Yes, there are alternative methods to assembly divisions, such as using larger registers or breaking the data into smaller pieces before it reaches the CPU. Other methods, such as parallel processing or using external storage, can also be used to handle larger or more complex data sets without relying heavily on assembly divisions.

Similar threads

Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Programming and Computer Science
Replies
30
Views
4K
  • Computing and Technology
Replies
0
Views
171
  • Engineering and Comp Sci Homework Help
Replies
3
Views
983
Replies
1
Views
584
  • Programming and Computer Science
Replies
14
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
Replies
7
Views
2K
  • Computing and Technology
Replies
5
Views
6K
Back
Top