Question: Let's do an example: 4 7 5 ( this value is called the minuend ) - 2 8 3 ( this value is called the

Let's do an example:
475(this value is called the minuend)
-283(this value is called the subtrahend)
----
192(this value is called the difference)
Working from right to left, we subtract 5-3 and get 2. We then subtract 7-8 we get -1; so we need to do a borrow, which makes it 17-8 so the answer is 9, with a borrow of 1. We then subtract [4-1(the borrow)]-2 to get 1. The result is therefore 192.
What is really going on in the computer's memory is a little different. These digits are really stored as their ASCII codes:
525553
-505651
----------
495750
This answer is computed almost exactly as described above, but one additional step is required because the numbers used are not equal to the digits they represent: they are larger by 48. Consider the subtraction of 51 from 53(ascii '3' from ascii '5'):
53-51(48+5)-(48+3)
In other words, we're subtracting 5-3, but we're also adding to that 48-48. The result we want is 50, which is (48+2), but if we just subtract the two digits, we'll get 2 because we subtracted out the 48's; this is the ASCII code for the start of text (STX), which is clearly not what we want. The solution, of course, is to add 48 to the result (2+48=50); this is the extra step that is required in the algorithm. Create the mips code to do this example

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!