Week 01 Journal Number Systems - Hsanokklis/2022-2023-Tech-journal GitHub Wiki
Source #1 - Number Systems: Decimal, Binary, Octal and Hexadecimal
base/radix: The building blocks of number systems that are represented by a combination of letters and digits. Any base number system functions on Logarithms.
Each number system functions with the basic rules no matter if decimal, binary, octal or hexadecimal. There is a starting number that is always the first digit in the system. You then count up until you have used up all the digits in your system then add a zero to the right of your starting digit. Then you can count up again and place another zero and continue this process until you get to the number that you want.
Ex: I want to make the number 26. To do this I start with 0 then I count all the way up to 9, before I run out of digits and have to make the 9 a 1 and then place a zero next to the 9. This makes 10, which is how decimal or base 10 works. Then I count that zero all the way up to 9 which will get me 19, and then I increase the 1 again and make the 9 a zero to get 20. Then I start counting up the zero again until I get to 6, and no I have 26. In reality 26 is just two 10s and one 6 or (10*2) + 6.
The example above was for the decimal number system, a system that is common to us. Binary, Octal, and Hexadecimal are number systems that are mainly for computers to understand but they work in the same way that decimal numbers work. Binary works on base 2, so each next number is two times the last, and it only uses two digits, which are 0 and 1. Octal uses 8 digits(0-7) and Hexadecimal has 16 digits(0-F).
Decimal: 1,2,3,4,5,6,7,8,9 Binary: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001 Octal: 1,2,3,4,5,6,7,10,11,12 Hexadecimal: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Source #2 - Hexadecimal Notation
Hexadecimal is represented by digits 0-F.
https://medium.com/coderscorner/hexadecimal-notation-c696eb32328a
Each singular hexadecimal can be written as 4 binary digits as shown in the table above. Hex starts out in the same way as decimal but then once it gets to the letters, you just have to remember that the letters have a numerical value, such as A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. Programming languages such as Java and C use 0x to show that a hexadecimal value is being written.
* hexadecimal values can be written in either uppercase or lowercase or a mix of both and you will still get the same output, but I find it good practice to keep all the values uniform.
Ex: Hex to Binary (using single digit values) Hex value: 64B32A
6 - 0110 4 - 0100 B - 1011 3 - 0011 2 - 0010 A - 1010
Ex: Binary to Hex Binary value: 1100 0010 1001 1010 1011 0001
1100 - C 0010 - 2 1001 - 9 1010 - A 1011 - B 0001 - 1
Source #3 - Signed and Unsigned Numbers: How computers represent numbers
The number system that computers use to function is binary. Essentially all the data we see on our screens is made up of a bunch of 1’s and 0’s.
https://medium.com/@LindaVivah/learn-how-to-read-binary-in-5-minutes-dac1feb991e
I have a little bit of experience with number systems from previous courses. The example above is the easiest way that I have found to figure out binary numbers in my head. It's just a matter of adding up the numbers until you get the number you need, and then you put a 1 for each number that you actually used. For example if I wanted the number 31, I know that 16+8+4+2+1 is 31 so I can write the binary as 00011111.
Computer word: a unit of data with a specific bit size that the CPU(central processing unit) can process at one time. Computers used to use 32 bit word sizes but now they use 64 bit word sizes because 64 bits allows for a lot more numbers to be made.
https://medium.com/coderscorner/signed-and-unsigned-numbers-c8cdc54bff87
In a 32 bit word we can represent the numbers from 0 to 2^32 or -1(4,294,967,295). The bit on the left is called the least significant bit and the bit on the right is the most significant bit. These bits are important because they can help us differentiate between negative and positive numbers. The sign bit, or the most significant bit will tell us if the number is positive or negative. It's positive when the value is 0 and negative when the value is 1.
Unsigned number: numbers that only contain the magnitude of a number, so they are all positive.
W bits ??? - each set of 1 bits is called a word and they normally consist of 32 bits or 64 bits by default. The number range is 0 to 2^w -1, from what I gather this is a sort of equation for when figuring out what the number in the bit is supposed to be. And two’s complement encoding??? Works with the w bits to get the equation and figure out the number.
An example here of a 4 bit word that is 1001 I believe can be calculated as:
(-1 x 2^3) + (0 + 2^2) + (0 x 2^1) + (1 x 2^0 ) = -8 + 0 + 0 + 1 = -9
The first 1 is negative because that is the most significant bit and when the most significant bit is 1 then the number is negative. The numbers that you are adding to the exponents are the numbers in the binary bit.
Number range for w bits is -2^w-1 to 2^w-1 -1 ???
The maximum value for w bits is all the bits are set to 1, because that means they are being “used” and the sign bit is set to 0 which would mean the bit word is a positive number. I understand this concert but I don't understand how the minimum bit value works.
When you have 4 bits this is how you can write the max value:
(0 x 2^3) + (1 x 2^2) + (1 x 2^1) + (1 x 2^0) = 4 +2 +1 = 7
The leftmost of the equation is 0 x 2^3, the zero is the most significant bit which makes the number positive. Then you have ones in the 0 place for the other parts of the equation because the binary number would be 0111 since that is the biggest bit word you can make with 4 bits.
Zero Extension: ??? Used to convert an unsigned number with w-bits to a number with more than w bits. This is done by adding 0s to the left of the number. If you want to convert a 16 bit to a 32 bit, you just need to add 16 zeros to the left of the 16 bit w bit.
Sign Extension: ???
Used to convert a two's complement number to a word with more than w bits.
You can do this this in a few steps:
Invert every 0 to 1 and every 1 to 0, and add one to the result
If you're converting from a 16 bit word to a 32 bit word, you copy the sign bit 16 times to the left.
**Source #4 - Binary Numbers and Base Systems as Fast as Possible **
Computers run on electricity and they use the number system of binary to work. Binary is a number system that consists of 2 symbols, 1 and 0 or on and off. Binary can also be called base 2. Because each new digit in a binary number needs to have a value that is 2 times greater than the last value to its right.
Binary is just one of many number systems. We commonly use decimal or base 10. Decimal uses 10 symbols, 0-9. In base 10 each new digit needs to have a value that is 10 times greater than the last value. There are many number systems we could have chosen to use beside base 10, like base 8 or base 12 because they are more evenly divisible by other numbers. But it is likely we use base 10 because we have 10 fingers.
Positional notation: Is the term that defines how number systems work. Where digits each have a place value and are placed so that the numbers further left are bigger by a certain base.
Alphanumeric: Number systems that use more numbers that 0-9 often incorporate letters for any number bigger than 9. An example would be hexadecimal. The letter A represents the number 10. If you were to use the whole alphabet with both uppercase and lowercase letters, you could get all the way up to base 62. As a real world example, when you look at URLs, they often have a long scramble of letters and numbers, and what that is, is just a really big alphanumeric number.