Study sets, textbooks, questions
Upgrade to remove ads
Terms in this set (42)
What is fixed point?
choose where the binary point lies & is the same for all numbers. need to balance precision & range when using fixed point
What does 1 b.p mean in terms of precision & range?
1 b.p. means you can only represent numbers to a precision of a half (can't represent 8.25) but large range of values (up to 15.5)
What does 4 b.p mean in terms of precision & range?
4 b.p. in a 5 bit system means you can't represent values greater than 1.9575- small range but high precision
What is floating point?
can move binary point, more flexible
What is an example of floating point?
Scientific notation is an example of floating-point e.g. 1.45 x 10^5: 1.45 is the significand & 10^5 is the exponent
significand & exponent can have positive or negative values
What is an example of binary floating point?
1.0101 x 2^5
Why do computer systems need to have the same formats?
need computer systems to have the same formats so they can communicate- there are standards for storing binary floating point numbers
What does IEEE stand for & what did it do?
IEEE (Institute of Electrical & Electronics Engineers) specified a standard for representing floating-point binary numbers.
How many versions are there within IEEE-754?
many versions within the IEEE-754 formal depending on the number of bits you want to use
What are the most common versions of IEEE-754?
single precision (32-bits) & double precision (64-bits) as modern computers are usually a 32 or 64 bit architecture
What do these formats of IEEE-754 specify?
1. a number of bits assigned for the significand & exponent
2. a bias for the exponent (way to represent negative values)
3. a normalised formal (hidden leading bit in significand)
What are the 3 components of IEEE-754
3 components: sign bit (same as signed magnitude, 1 = negative), exponent, significand
What does assigning more value to the significand mean?
more values assigned to significand = can represent a greater range of values (represent more significant figures)
What is single precision?
1 bit for sign, 8 for exponent, 23 for significand
What is double precision?
1 bit for sign, 11 for exponent, 52 for significand
What is the exponent like?
exponent (want both positive & negative values)
format specifies a bias for the exponent- 127 for single precision, 1023 for double precision (gives an equal number of positive & negative exponents)
subtract bias from whatever value is stored in the exponent
What is an example of a single precision exponent?
e.g. single precision with an exponent of 01111010
01111010 = 122
122-127 = -5
Why is single precision used instead of two's complement?
bias allows the numeric ordering to be the same as the lexicographic (alphabetical) ordering (fast to compare the size of 2 exponents)
What is the significand like?
1. is normalised- implied leading 1 point before the stored significand e.g. 1.01011
2. this gives an extra bit of precision in the significand
3. also ensures there is a unique representation for values (stops there from being multiple ways to represent the same number e.g. 10.1 x 2^0 = 1.01 x 2^1: have to multiply to check equality)
How do you convert 1100000100101100000000000000000 to decimal?
1. sign: 1 so number is negative
2. exponent: 10000010 so do 130 - 127 (bias) = 3
3. significand: 01011 (and trailing 0s but 0s have no effect on the calculation) add leading 1. so
4. 1.01011 x 2^3 = 1010.11 = 10.75
5. negative so = -10.75
How do you convert -133.25 to single precision format?
1. convert magnitude to unsigned binary: 133.25 —> 10000101.01 (x2^0)
2. Convert to normal form: 10000101.01 —> 1.000010101 x 2^7
3. store everything after the binary point for significand & add remaining bits to get 23 bits: 00001010100000000000000
add 127 to exponent & convert to unsigned binary & 4. add any padding needed to get 8 bits: 7 + 127 = 134 134 —> 10000110
5. sign bit = 1 as negative number
6. full number: 110000110000010101000000000000000
When is the binary number not accurate?
when there is rounding
Can you have an exponent larger than 128 when using single precision?
Can't have an exponent more than 128 as 128 + bias would be too large —> leads to overflow, can switch to double precision but can't do this for all computer systems
Can IEE-754 represent 0?
1. IEEE-754 reserves special values for representing specific values
2. can't represent 0 using normalised form (due to implied bit) so there is a specific value for 0
3. specific values for + & - infinities & not a number (e.g. square root negative number) (NaN) values
What is +- 0 in IEEE-754 single precision?
0/1 00000000 000000000000000000000000
What is +- infinity in IEEE-754 single precision?
0/1 11111111 000000000000000000000000
What is NaN (not a number) in IEEE-754 single precision?
0/1 11111111 (any non-zero significand)
How do you add 2 floating point numbers?
1. Adjust the position of the binary points so the 2 significands have the same exponent
2. If the numbers have the same sign, add the significands. If the numbers have different signs subtract the smaller significand from the larger significand
3. If needed, renormalise the significand & adjust the exponent
4. Select the correct sign
How do you multiply 2 floating point numbers?
1. Add the exponents
2. Multiply the significands
3. If needed renormalise & set exponent
4. Select the correct sign
How do you subtract 2 floating point numbers?
use a - b = a + (-b)
How do you divide 2 floating point numbers?
same as multiplication but subtract exponents & divide significands
What are some common errors when using IEEE-754?
3. catastrophic cancellation
What is overflow when using IEEE-754?
magnitude is too large to store in the format
What is underflow when using IEEE-754?
magnitude is too small to store in the format (too close to zero to be distinguished from 0
What is catastrophic cancellation when using IEEE-754?
lack of significant figures to represent the result of colliding large & small numbers
What does IEEE-754 not have?
IEEE-754 doesn't have exact representations for common base 10 numbers e.g. 0.2 + 0.1 = 0.30000000000000004 (no 0.3 in single or double precision)
What is range?
difference between the max & min values representable in a given format (doesn't mean all values are representable within that range)
What is precision?
how much information a representation gives us of a value e.g. 3.14 has 2 digits of precision right of the decimal point
What does precision not always mean?
more precision doesn't always mean more accurate e.g. 3.14 is a more accurate representation of pie than 3.149 even though it is less precise
What is accuracy?
accuracy- how close a representation of a value is to the true value
e.g. no exact representation of 0.3 in binary : for 5 bit fixed-point binary with the binary point between index 4 & 3, 0.0100 = 0.25 is the most accurate representation of 0.3
What is relative error?
measure of the accuracy of a representation
How do you calculate relative error?
relative error = (T-R)/T X 100 where T is a true value & R is the represented value
Sets found in the same folder
Essentials of Computer Systems
Other sets by this creator
9 Making the most of models
8 Agile Software Development
10 Sorting Algorithms