Lecture 3: Data Representation Flashcards
How many bits is one hexadecimal digit?
4
How many bits is a word?
16
What is polynomial evaluation
1234(base 10) = 1 * 10^3 + 2 * 10^2 + 3 * 10^1 + 4 * 10^0
Basically times the face value by 10 to the power of the position that the digit is in. The right most digit is either 0, or for decimal is the smallest decimal point.
How do we convert binary to decimal?
We can use Polynomial evaluation
Can we use polynomial evaluation to go from decimal to binary?
No
How we convert a whole number to binary?
- Divide by the target Radix or Base (for binary this is 2)
- The remainder is either going to be a 1 or 0 and we use this in the binary representation.
- The outcome of the division then gets divided by the radix again with the remainder going into the binary number.
- Stop once the quotient = 0.
How do we convert a decimal to binary?
- Multiply by the target radix / base.
- The whole number will become the digit in the binary representation.
- Repeat with the new fraction.
What is representational rollover?
This occurs as a consequence of fixed precision in a computer. If we add one to a number, then we may lose digits off the left hand end giving a wayward number:
999 + 1 -> 000
What is overflow?
This is when we exceed the range of numbers that we are allowed to work in.
What is the radix for a hexidecimal number?
16
How many digits are there?
16, ranging from 0 -> 15
0->9 then A->F
What is the rule of thumb for twos complement?
Invert all bits and then add 1 on to the right.