Week 1 Reading: Number Systems - sullivaneg/TechJournal-SYS140 GitHub Wiki
Reading Journal
Number systems:
In this section I learned the three rules of a number system, the importance of zero, how to read numbers, and how to convert between hexadecimal and binary numbers. A number system is a system where you use characters to represent numbers. The three examples of number systems this reading covered were decimal, hexadecimal, and binary. Decimal is our classic base-10 number system, where all numbers are represented by the digits 0-9. Hexadecimal is a base-16 number system where the numbers are represented by the numbers 0-9 and the letters A-F, where A=10, B=11, all the way to F=15. Binary is a base-2 number system where all numbers are represented by 0’s and 1’s. In all number systems the digit 0 is important. It counts as one of the values. So a base-16 number system has 16 digits but only goes up to 15 because 0 counts as one of the digits. One of the things I learned in this reading was the 3 rules of any number system.
When you have used all your numbers you add a digit to the left and 0's to the right. ex) 999 + 1 = 1000.
Then you keep adding to the right until you hit all the numbers, then increase the digit on the left by 1. ex) 1999 + 1 = 2000
When you reach the limit on both the left and the right, make them both 0 and add a 1 to the left. ex) 9999 + 1 =10000.
No matter what base system you are using, the system will follow these three rules. In this section we also covered how to read numbers. Each digit represents a numerical value and each place value represents a number. Depending on the base, each place value will move up. For example in binary, each place value is 2x the previous one.
ex) Decimal
62302 = (6x10^4) + (2x10^3) + (3x10^2) + (0x10^1) + (2x10^0)
ex) Binary
100101 = (1x2^5) + (0x2^4) + (0x2^3) + (1x2^2) + (0x2^1) + (1x2^0)
Also in this section we covered how to convert between Hexadecimal and binary numbers.
| Hexadecimal | 3 | 9 | A | 7 | F | 8 |
|---|---|---|---|---|---|---|
| Binary | 0011 | 1001 | 1010 | 0111 | 1111 | 1000 |
In this example we are converting from Binary to hexadecimal. To do this you break the binary # into bits, if the bit isn't 4 digits long, add 0's to the left until there's 4 digits. I also challenged myself to solve this by myself.
This text was important because understanding number systems is the foundation of how all systems work. Being able to convert between systems is the basis for a lot of math and computer languages. I enjoyed this text. I had previous experience with binary, decimal, base-3 and base-5 number systems from math events but wasn’t familiar with hexadecimal so it was interesting to see how an alpha-numeric system operates. I would recommend this reading, it was a great introduction.
Signed and unsigned numbers:
In this section I learned the difference between signed and unsigned numbers, what words are, what Two’s complement is and how it works, zero extension and sign extension. A word in a computer is defined as data with a defined bit length. Most computers have moved from using 32 bit to 64 bit word length. For example the binary number 100100 as a 32 bit word would be 0000 0000 0000 0000 0000 0000 0010 0100. The bit on the far left of the word is the most significant bit and the bit on the far right is the least significant bit. If you have w bits the amount of numbers you can represent is 0 to 2w-1. This method works to represent unsigned numbers because you don’t have to represent the negative. If you want to represent a negative number, Two’s complement is a method you can use to represent signed integers (negative or positive numbers). In this method the most significant bit has negative weight so all negative numbers have a 1 in that far left slot, this is known as the sign bit. For a positive number you have 0 in that far left slot. Using Two’s complement, if you have w bits the range of numbers is -2w to 2w-1-1. If you have w bits, the minimum value you can represent is -2w-1. For a 4 bit number, the minimum value is -8 because you can have a 1 in that far left slot. The maximum value for 4 bits is 7 because you can’t have that one in the far left. The next thing I learned in this section was how to convert a number into a number with more bits. For unsigned numbers you use Zero Extension. You take the number and add 0’s to the left until you reach the wanted bit length. It gets a little more complicated when you try to do this with signed numbers. For signed numbers you use Sign Extension. To convert a negative number in Two’s complement to a certain bit size you add 1's to the left. A shortcut for this is converting all 1’s to 0’s and all 0’s to 1’s and then adding 1 to the answer (??? I kind of understand this) I had a hard time understanding WHY the numbers added up the same if you added a ton of 1's but I came to understand it like this:
-410= 1111 1100
-410 = -128+64+32+16+8+4+0+0
-410= -128+124
-410= -4
This reading was important because it introduces how to represent negative numbers in a computer system. This allows all negative integers to also be represented. It’s also important to know how to move between bit sizes because as computers advance the standard word length might change, the way that computers went from using 32 bit to 64 bit word lengths. One thing I struggled to understand was the Sign Extension. I made sense of it arithmetically but I’m not sure if what I did is actually how it’s laid out. I haven’t had any personal experience with any of the topics covered in this reading so it was really interesting to me.
Binary #'s and base systems as fast as possible:
This section was a video where the man talked about binary systems and explained how to represent numbers. He also explained that the way the number systems are laid out is called “positional notation.”
This whole video was review for me. A lot of the topics I already understood or had just read about in the first section of reading. The only thing I hadn’t heard before was the term positional notation but I was familiar with the concept. I would recommend this video for people with no understanding of binary since it covers a lot on a very basic level.