Notizen
Computer Org. 2019.01.18
Inhalt der Notizen (1)
Seite 1
In binary start from right to left
Only add the numbers that are "1" and not "0"
Start at 0 in Binary.
Example: 0 - 9 for Base 10
Binary Addition of 1 bit. 1+0 = 0+1 = 1
(See slide)
Binary Addition (slides)
There are 32 distinct numbers you can get out of 5 bits
In C++ its possible to say: unsigned int x=743;
This means use all the bits there are to represent 743 and no implementation to represent positive or negative, its going to be positive.
Negative numbers. Idea #1: Sign & Magnitude
High bit = 0 means 'positive'
High bit = 1 means 'negative'
Problem 1: We have two zeros.. that is wasteful.
Problem 2: Math doesn't work easily
Negative numbers. Idea #2: '2s Complement'
Harder to understand but more efficient
1 is still a flag that # is negative
One zero +0
Removing the extra zero, -0 now allows for one more negative number (-16)
Will be on exam:
The largest number you can find in a 5 bit signed integer is 15
The smallest number in a 5 bit signed integer is -16
Unsigned: Not losing the top bit
Quiz next week on Binary
When there are three ones in a column you will carry one over
When there are two ones you will carry the one to the next column
Don't be confused. You are adding one to the flipped bits to show that it is now negative. (Example: Slide 39)
How to Negate a Number:
Step 1: Flip all the bits (also called 1’s Complement).
0 becomes 1
1 becomes 0
Step 2: Add 1
What's wrong with Binary:
Humans are poor at remembering long strings of 1s and 0s
Headaches! Errors!
Make it simpler with 'shorthand' notations (we can have an easier way to write it down):
Hexadecimal (Base 16)
Octal (Base 8)
Hex(hexadecimal) is Base 16:
Represents groups of 4 bits
Use ‘alphabet’ of 0-9 AND a-f to create 16 ‘hex digits’, using 1 char
Ended on slide
Informationen
- Beschreibung
- Computer Science (Computer Org) Notiz am Computer Org. 2019.01.18, erstellt von Ryan Monaghan am 18/01/2019.
- Erstellt von
- Ryan Monaghan
- Aufrufe
- 0
- Bewertung