+ 1
how the computer multiplies or divides?
do I know that when adding, the computer adds the bits with the help of some gates, and could someone help with the multiplication division?
6 odpowiedzi
+ 3
Better search on Google for "How an ALU works". There is plenty of information available.
+ 3
The long explanation converted into short code:
https://code.sololearn.com/cl74QmLjwbGO/?ref=app
+ 2
This is how I think computer calculates division, I think it os based on testing results with *.
If:
numerator / denominator = quotient
Then:
denominator * quotient = numerator
Computer could use this information to calculate the division result.
Computer would start with 4 variables:
nominator,
denominator,
quotient = 0
counter = 1
Computer would start a loop with undefined break.
In each iteration it would compare the nominator to this expressiln:
quotient + counter * denominator
If the nominator is equal to the expression, this will be added to the quotient:
counter * denominator
and the loop would be broken.
If the nominator is less than the expression, the counter would be divided by 2 using >> and the loop would continue from the next iteration.
If the nominator is greater than the expression this would be added to the quotient:
counter * denominator
after that counter would be multiplied by 2 and loop continues to the next iteration.
+ 1
What is an ALU?, sorry just i am a student, and i now sutdy at home
+ 1
ALU stands for "arithmetic logic unit".