Sunday, 21 October 2012

Arithmetic for Computers

Hello! We’re back again, now bringing up the second topic to be discussed about. We picked the second topic from our semester’s syllabus that is, Arithmetic for Computers (Number Systems and Operations)

From what we understand from the exact definition of arithmetic, it is actually the oldest and most elementary branch of mathematics that is used by almost every single studying person, for tasks ranging from simple day-to-day counting to advanced science and business calculations. It includes the study of quantity, especially as the result of operations that combine numbers. In common usage, it refers to the simpler properties when using the traditional operations of addition, subtraction, multiplication and division with smaller values of numbers.
So basically, arithmetic is all about numbers and operations involving numbers. As we always know, we humans use the decimal number system to perform arithmetic operations including every numbers to infinity. On the other hand, not for the computers, that uses the binary system, containing only two digits that are 0 and 1. We need a way to convert numbers from one system to another in order to allow computers to understand us.
All the number systems we use practically operate on some basic principles where each of it has a base as we will look at decimal with base 10, binary with base 2 and hexadecimal  owning base 16. The base denotes the number of digits and the powers to be used. Base 10 has 10 digits that are numbered from 0-9 and uses the powers of 10. However, base 2 has 2 digits that numbered from 0-1 and uses powers of 2 whereas base 16 has 16 digits which numbered from 0-F (where the letters A-F serve as the digits following 9), and uses the powers of 16.
Other than that, each of these systems of number is a positional notation system meaning that the location of a digit in the number determines its value. As an example, the value of 6 in the decimal number 631 is not the same as the value of 6 in 361 or 136.

So in this explanation part, we'll be using the decimal number system to show how the positional notation system works. Assuming that we have the number 631, what this number means? Each digit represents that digit itself amplifying the power of 10 represented by its position. Don’t forget that the decimal point is supposed to be on the right of the number if it is not explicitly shown. Starting at the decimal point and moving to the left, the columns represent increasing powers of 10. Now we are showing the steps.

102       101       100
6          3          1

The base of the numbers is 10 because the number is initially in decimal form, and the exponent (the superscript) tells what power of 10. The exponents increase by 1 with every move to the next position to the left. Note that the exponents also decrease by 1 with each column move to the right, so the first position to the right of the decimal place tells how many 10-1's are in the number, and the second position to the right of the decimal place tells how many 10-2's are in the number and so forth for other bases.
Recall that any number to the zeroth power is 1, and any number to the first power is that number itself. So the column labeled 100 denotes how many 1's are in the number, the column labeled 101 represents how many 10's are in the number, and the column labeled 102 shows how many 100's are in the number as shown below;
100's column              10's column                1's column
6                      3                                  1
Thus this number has 1 ones, 3 tens, and 6 hundreds, where
1 x 100 = 1 x 1 = 1
3 x 101 = 3 x 10 = 30
6 x 102 = 6 x 100 = 600
So by summing up all those numbers, we will get the number in base 10.
1 + 30 + 600 = 63110
But we basically do not put the subscript for base 10 because base 10 numbers are the numbers we are always using. On the other hand, we do for the other bases like 100011002, 112358 and AE4316. This is due to the using of these bases that is not too wide excluding for those who are involved with computers.



Operations on Integers
There are some operations in dealing with integers in number system. I’m sure every single studying person learn basic operation involving numbers, right. What else could it be other than addition, subtraction, multiplication, division and in this case we also had to deal with overflow in those operations.
Let’s get started with the simplest operation that is addition. If the yield is out of the range, there will be an overflow. Simply, adding positive and negative operands will result in no overflow. But adding two positive operands will result an overflow, but if only the yield sign is equal to 1. In the other hand, the operation of summing up two negative operands will result an overflow only if the result sign is 0.
Saem goes for subtraction operation of integers. There will be an overflow when the value produced is out of the range. There will be no overflow when the operation involves subtraction of two positive or two negative operands. But if the result sign is 0 after subtracting positive from negative operand, there will be an overflow. The overflow will also exist when the result sign is 1 after subtracting negative from positive operand.

Dealing with Overflow
Here are some ways to handle the overflow cases. Somehow, some languages such as C. will just practically ignore overflow. We can use MIPS addu, addui, subu instructions to deal with it. We can also use other languages as Ada and Fortran. But using these languages require a raising an exception. So it is quite difficult to be settled. We might also use MIPS add, addi, sub instructions for other incentive. Plus, we can invoke exception handler on overflow as one of the ways to deal with it. Next step is just by saving the PC in exception program counter (EPC) register.
As multimedia-majoring students, we absolutely need to know these, that arithmetic is such a basic thing in multimedia. It is the foundation that makes the media up, compiling those media becoming multimedia, such a perfect, attentive presentation medium to be used by us, the users. In this prospect, graphics and media processing operates on vectors of 8-bit and 16-bit data.
Next, let’s move on to multiplication operation of integers. As an example taken from our notes,

The upper operand is called multiplicand while the lower one is known as the multiplier. The length of product is the sum of operand lengths.

The next one is division operation. Note that if the divisor is less than or equal to its dividend bits, it will be 1 bit in quotient, and then subtracting the two operands. Otherwise, the other 0 bit in quotient, we will just bring them down next to dividend bit.


Floating Point

Floating points is the way of representation for non-integral numbers including smallest and largest numbers. As if in scientific notation;
–2.34 × 1056
+0.002 × 10–4
+987.02 × 109

Floating point standard is defined by “IEEE Std 754-1985”. It is developed in response to divergence of representations which is a portability issues for scientific code. IEEE Std 754-1985 is now almost universally adopted. Other than that, there are two ways of representations the floating point standards those are single precision (32-bit) and double precision (64-bit).

Okay! Now we are finished with our short brief explanation about arithmetic involved in computers. We do hope that you understand and the information we have prepared will be able to help you in improving your understanding towards arithmetic Number System. A lot of thanks for spending your precious time to visit our page!
^_^


No comments:

Post a Comment