home       basis       routing       switching       advanced       security       overig       testen       english      

Binary arithmetic


Binary to Decimal and vice versa calculations

You have to be able to calculate binary numbers:
convert between binary, decimal, and hexadecimal number systems,
in order to work with IPv4 and IPv6 addresses,
and to determine the size of networks based on the netmask.
  
You can read the following website as background:
http://beterrekenen.nl/website/index.php?pag=259
 
The instructor teaches several methods in class. Learning to calculate with IP addresses is spread over several lesson days, always during the first half hour of the class.
There is also a LAB, number systems, which we will work with.
 
Android apps
bitcalculator
base converter
binary grid
 

  
Example decimal to binary
  

 BASE-nr   (OCTET)  |   POWER OF 2    |   DOES IT FIT
                    |                 |
             243    |       128       |     1   (yes)
                    |                 |
 243 - 128 = 115    |        64       |     1   (yes)
                    |                 |
 115 -  64 =  51    |        32       |     1   (yes)
                    |                 |
  51 -  32 =  19    |        16       |     1   (yes)
                    |                 |                    |
  19 -  16 =   3    |         8       |     0   (no)
                    |                 |
               3    |         4       |     0   (no)
                    |                 |
               3    |         2       |     1   (yes)
                    |                 |
   3 -   2 =   1    |         1       |     1   (yes)
                    |                 |
               0    |                 | 

RESULT: 243 = 1 1 1 1 0 0 1 1

Exercise: convert the following numbers to binary:
187 / 219 / 113
 
Exercise: convert the following IP addresses to binary:
192.168.5.237
255.255.255.240

Exercise: convert the following binary numbers to decimal
 
method:

place the binary octet in a frame with 8 boxes
 
 ---- ---- ---- ---- ---- ---- ---- ----  
| 128| 64 | 32 | 16 |  8 |  4 |  2 |  1  | 
 ---- ---- ---- ---- ---- ---- ---- ----  
 
where you place a binary 1, keep the decimal value;  
where you place a binary 0, erase the decimal value.  
then add the remaining decimal numbers together
 
example:
 
1 1 0 0 1 0 1 1
 
 ---- ---- ---- ---- ---- ---- ---- ----  
| 128| 64 |    |    |  8 |    |  2 |  1  |   = 128 + 64 + 8 + 2 + 1 = 203
 ---- ---- ---- ---- ---- ---- ---- ----  

problems:

  • 1001 0011
  • 1010 1010
  • 1110 0111
  • 0111 1111
  • 0011 1111