mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
fix: overflow corrections when finging the middle of a segment
This commit is contained in:
parent
6376bf46af
commit
0f9be588da
@ -55,7 +55,7 @@ int main() {
|
||||
|
||||
// start iterations
|
||||
for (i = 0; i < MAX_ITERATIONS; i++) {
|
||||
x = (a + b) / 2;
|
||||
x = a + (b - a) / 2;
|
||||
z = eq(x);
|
||||
std::cout << "\n\nz: " << z << "\t[" << a << " , " << b
|
||||
<< " | Bisect: " << x << "]";
|
||||
|
Loading…
Reference in New Issue
Block a user