Data Rep & Number Systems Flashcards

1
Q

1 byte = ? bits

A

8 bits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

N bits can represent up to how many values?

A

2^N values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Unsigned vs Signed

A
Unsigned = only non-negative values
Signed = all values (positive & negative)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 3 common representations for signed binary numbers

A
  1. Sign-and-magnitude
  2. 1s Complement
  3. 2s Complement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the range for an 8-bit for the 3 common representations?

A

Sign-and-Magnitude:
-127 to +127, +0 and -0

1s complement:
same as ^ (-(2^(n-1) - 1) to 2^(n-1)-1)

2s complement:
0 is associated with the positive side, which means positive side get to represent 1 less.
-(2^(n - 1)) to 2^(n-1) - 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the shortcuts for deriving the complements?

A

1s complement:
Invert all the bits

2s complement:
Invert all the bits then add 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the algorithm for addition/subtraction using both complement systems?

A
  • Perform addition for both
  • Check for overflow:
    1. + and + = -
    2. - and - = +

1s complement:
Add back the carry out of the MSB

2s complement:
Ignore the carry out of the MSB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of excess representation?

A

Allows the range of values to be distributed evenly between the positive and negative values.

It shifts all the values by Excess-N amount.
The MSB denotes whether is it negative/positive:
0 -> negative
1 -> positive

Usually N is determined by the taking 2^(number of bits - 1) or 2^(number of bits - 2).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the different components in an IEEE 754 Floating-Point rep?

A
  • Convert the decimal into binary
  • Normalise the binary
  1. Sign:
    0 for positive
    1 for negative
  2. Exponent:
    Uses excess-127 representation
    127 + the power derived from normalising, then convert to binary
  3. Mantissa
    Normalised with an implicit leading bit 1
    Copy over the values in the fraction portion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly