Diferente pentru blog/your-bisection-search-is-wrong intre reviziile #23 si #25

Nu exista diferente intre titluri.

Diferente intre continut:

switch to
==code(python) |
while abs(c - lo * lo * lo) < 1e-3:
while abs(c - lo * lo * lo) > 1e-3:
==
This doesn't work. For large numbers like 1e37 the code goes into an infinite loop. Try to figure out why. Discuss it in the comment section. Let’s try using the *relative error* (|(a - b) / b| < eps). There are some weird cases when a and b are close or equal to 0. Can the code be cleaner?
notes:
* Thanks Tomek for pointing out the iteration problem and possible efficient solutions.
* When c is large, mid * mid * mid will overflow but the algorithm still works.
* We’ve addressed negative numbers, numbers in (0, 1), overflow problems, absolute and relative error problems.
* Some tests for your own code -1, 0, 1, 2, 8, 0.001, 1e30, 1e60
* In practice faster methods like Newton Rapson method are used.

Diferente intre securitate:

public
protected

Topicul de forum nu a fost schimbat.