Binary number system Flashcards

Overflow error, all things binary (24 cards)

1
Q

Unsigned binary

A

All unsigned means is the there is no indication of + or -, assumed to be a positive integers.

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

Range of unsigned binary

A

This is referring to the minimum and maximum values a certain number of bits can represent. Not the same as doing 2^n, as this shows the number of different values we could represent, not what the maximum value is. The minimum is always 0, maximum is 2^n -1.

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

Addition of unsigned binary

A

Put the two binary numbers on top of each other, like column addition, with space for carried digits. Then just compare each digit on top of each other. Basic rules: 0+0 = 0, 1+0=1, 0+1=1, 1+1 = 0 carry the one to under next comparison. 1+1+1 = 1, and carry 1.

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

Multiply unsigned binary

A

Line up two values as far right as possible. Then go through multiplying the top by each digit of the bottom. So 10110111 x 1 = 10110111, 10110111 x 0 = 00000000. Very simple. Every time you move a number in of your multiplication number, put a 0 at the start before anything, should cause an extra digit on the left each time. When you’ve multiplied each one, add them for a final answer.

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

Overflow errors

A

When adding or multiplying binary, sometimes the number produced can be too large for the specified number of bits. Therefore, the actual number can’t be represented so theres an error. For example if there are a specified 8 bits, but the answer needs 9 bits as theres a 1 in the left most bit, theres an overflow error as 8 bits can’t represent it. In calculations, remove overflowed digits, don’t show any digits above the specified bit number.

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

Signed binary integers

A

Unlike unsigned binary, signed binary can be negative as well. To represent negative binary two’s compliment is needed. Can be used on positive binary as well, but its necessary for negative numbers

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

Representing binary with two’s compliment

A

Left most bit is set as negative, e.g for an 8 bit number, it starts with -128, then 64, etc. For positive numbers, left most bit must be 0, rest is normal. For negative, left most must be 1. Then the others can be added to adjust what negative number it is.
-128 64 32 16 8 4 2 1
1. 0 1. 1 0. 0 0 1. = -79

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

Finding negative equivalent to positive numbers

A

It might ask you to show the equivalent to a + number as a negative, like 25 as -25, but in binary. Simply flip all digits except the lowest value thats a 1 not a 0
e.g 0010110 (22) becomes 1101010 (-22)

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

Addition in two’s compliment

A

Exactly the same as normal, just the first value is still a negative value when working out in denary, but literally no difference when adding. Overflow errors can be worse as they cause negative numbers to appear positive.

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

Subtracting numbers in two’s compliment

A

Subtraction can only be done with two’s compliment. Treat it as an addition, remember that its just 93 + (-35) for a subtraction. Convert both to two’s compliment, so you’ll have to make the second one negative, then add them.

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

Range of values in two’s compliment

A

Largest positive integer, is everything but the left most value, so it’s 1 less the the total bits, -1. For example in an 8 bit number, it would be 2^7 -1. For the smallest possible integer, it would be only the left most integer. So in an 8 bit number, it would be -2^7. Largest is 2^7 - 1, smallest is -2^7.

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

Fractions in binary

A

The scale just continues with 1/2, 1/4, 1/8 and so on. Basically keeps halving like normal. Same in two’s compliment

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

Fixed point form

A

Binary point set at a specific place, so the ratio of bits for the fractional part and the whole part cannot change. Therefore a trade off has to be made, lots of bits could be on the whole side, allowing a large number to be represented, but sacrificing the ability for accuracy in the fractional part, and vice versa.

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

Floating point

A

The binary point can be moved, allowing both very large numbers, and very small precise numbers to be represented. Expressed with a mantissa and exponent.

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

Mantissa and exponent

A

Mantissa is a longer binary number, and the exponent is a shorter one that is used to scale the size of the mantissa. It is the same as standard form. Both use two’s complement.

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

Floating point to denary

A

Convert exponent to denary, if its +, move the point that number of places to the right, if its negative, move it that number of places left. Note, if it goes off the end, for a positive mantissa, fill new values with 0’s, for negative mantissa, fill them with 1’s. Then work out mantissa into denary normally.

17
Q

Normalisation of floating point

A

Positive mantissa is normalised if it starts with 0.1. Negative mantissa is normalised if it starts with 1.0. Do this, then count how many spaces you moved it. If you had to move it right, then subtract this number from exponent, and rewrite in binary. If you had to move it left, then add this number to the exponent, and rewrite in binary.

18
Q

Denary to floating point

A

Convert to fixed point binary, then normalise, and adjust exponent.

19
Q

Overflow

A

When the number is too large to be represented by the number of allocated bits.

20
Q

Underflow

A

Number is too small to be properly represented, not enough decimal bits.

21
Q

Truncation

A

If not enough bits for number, just removes bits it can’t represent, loses accuracy

22
Q

Rounding

A

Same as truncation, but you just make sure the last represented number is a 1.

23
Q

Absolute error

A

After rounding or truncation, this is the difference between what the number is supposed to be, verses what you’ve represented it as.

24
Q

Relative error

A

Just the absolute error, divided by the original number. Can be x 100 to give percentage relative error