Lecture 5 Flashcards

1
Q

How does the Bisection Search method work?

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

How is the Bisection Search method more efficient than Exhaustive Enumeration in finding the square root of a number computationally?

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

Is it possible to always convert a real, decimal number to its binary correpondent?

A

No, some decimal numbers cannot be precisely convert to its binary form since this would require an infinite number of bits. In this case, the practical approach is approximate it, introducing some error.

For example:
3/8 (0.375) in decimal form corresponds to 0.011 in binary

1/10 (0.1) in decimal form leads to an infinite number in binary (0.0001100110011001100…). The more significant digits are used, the better the approximation becomes.

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

What is the proper way of comparing floats?

A

**Never use == **

Compare the difference instead, or the module of the difference, to a certain tolerance.

Since Python converts decimals to binary, the approximation error might add up during calculations, resultin in unexpected behaviour.

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