CuriouSTEM

View Original

Computer Numbering Essentials

Computer numbering essentials are the different ways in which numbers can be represented in computers or calculators. We know that computers understand data represented in the binary format. But there are many other systems in use as well. Let’s look at them :

  • Bits, Bytes and Unsigned numbers: We have previously seen that when bits are used, they represent just two values 0 and 1. Using 8 bits we get a byte. In computers either a single byte or multiple bytes are used to represent data. The more the number of bits, the more values it can represent. Using 4 bits we can represent 16 values, using 5 bits the number of values doubles. Unsigned numbers don’t represent negative numbers.

  • Signed numbers and two’s complement : As we saw earlier unsigned numbers can represent only positive numbers. Hence we need the concept of signed numbers where 1 bit is assigned to denote the sign of the number; if it’s 1 it's negative or else it's positive. But this system has an obvious problem as 0 can be viewed as both positive and negative. So the entire subsets of combinations of bits for a 4 bit number can be split into two halves. The first half with first digit 0 (0000, 0001) can be viewed as positive and the other half as negative(1100, 1001). They would be assigned values as 0,1,..7,-8,-7…-1.

  • Hexadecimal and Octal numbers: In the Hexadecimal number system, the numbers are 16 digits( 0,1,2 … a,b,c,d,e,f). While the octal system has 8 digits( 0,1,2..7). These two systems are much easier compared to the binary system to represent different numbers. They are commonly used.

  • Floating numbers: In the decimal system we can represent fractions easily. A number like 0.00345 can be easily represented as 3.45E-3. In computers as well we have a standard format to represent such floating numbers. There is a 11 bit binary exponent(E), which is an unsigned number. To get the original value we need to subtract 1023 from the value. The mantissa(in above example, 3.45) is represented by a 52 bit number and the sign by a sign bit.

Picture Source: myventurepad.com