DB section has been updated to add some SQL code.
Describe and exemplify the use of binary to represent positive integers.
Convert from binary to denary and vice-versa.
We will look at two types of numbers
Integers
Real Numbers
Integers are whole numbers, they have no decimal portions. Can be positive or negative
Real numbers are numbers that have a decimal portion. Again can be positive or negative
We use the decimal (denary) or base 10 system. This means we have 10 digits : 0-9.
Computers use the binary or base 2 system. There are only two digits: 0 and 1.
Each digit is known as a bit, this stands for Binary digit. There are 8 bits in a byte.
Let’s look at how a decimal integer number is made up:
Example denary number (173).
Technically this is
The same denary number (173) shown with with place values shown at the top.
Let’s look at how the same number is stored in binary: 1010 1101 = 173
You still start off with your decimal number 173
Divide it by 2 and if there is no remainder then your binary digit is 0, if there is a remainder your binary digit is 1.
You then carry on dividing until your number is 0
The tutorial video above will cover the division method of converting an integer in denary to binary.
Let’s look at the same example:
Binary Number = 1010 0101
Let’s look at converting the binary number 0110 0110 into decimal.
1 Create your table with the values in the top
2. Insert your binary value into the table.
3. Add the place values that have a binary 1 in them: 64+32+4+2 = 102
There are three advantages why computer use the binary system.
0’s and 1’s (two states) are easy to represent in a digital system. Can be represented using magnetic fields, pits and lands in CD’s.
Any drop in signal does not affect the data.
There are less rules of arithmetic in the binary system.
0001 1001
0110 1100