232 double a, b,
c, x0, x1;
233 double dx0, dx1, d2x, diff;
235 int a_mag, b_mag, c_mag;
249 dx0 =
set[1]->s.real -
set[0]->s.real;
250 dx1 =
set[2]->s.real -
set[1]->s.real;
252 x0 = (
set[0]->s.real +
set[1]->s.real) / 2.0;
253 x1 = (
set[1]->s.real +
set[2]->s.real) / 2.0;
255 d2x = (
set[2]->s.real -
set[0]->s.real) / 2.0;
257 zaddeq(&a, &a_mag,
set[1]->f_def.real,
set[1]->mag_def,
258 -
set[0]->f_def.real,
set[0]->mag_def);
266 zaddeq(&b, &b_mag,
set[2]->f_def.real,
set[2]->mag_def,
267 -
set[1]->f_def.real,
set[1]->mag_def);
275 zaddeq(&c, &c_mag, b, b_mag, -a, a_mag);
283 if (c == 0.0 || (a == 0.0 || c_mag < a_mag - 40)
284 && (b = 0.0 ||c_mag < b_mag - 40)) {
291 new->s.real = -
set[1]->f_def.real / a;
292 a_mag -=
set[1]->mag_def;
301 new->s.real +=
set[1]->s.real;
303 new->s.real =
set[1]->s.real;
314 diff =
set[1]->s.real - x0;
318 zaddeq(&a, &a_mag, a, a_mag, diff, tmag);
321 b = 2.0 *
set[1]->f_def.real /
c;
322 b_mag =
set[1]->mag_def - c_mag;
326 disc_mag = 2 * a_mag;
329 zaddeq(&disc, &disc_mag, disc, disc_mag, - b, b_mag);
337 if (disc_mag % 2 == 0)
340 disc = sqrt(2.0 * disc);
352 DEBUG(1) fprintf(stderr,
353 "Ignore NIpzK: %
g*2^%
d for previous value of %
g*2^%
d\n",
363 if (a * disc >= 0.0) {
364 zaddeq(&c, &c_mag, a, a_mag, disc, disc_mag);
366 zaddeq(&c, &c_mag, a, a_mag, -disc, disc_mag);
379 zaddeq(&b, &b_mag,
set[1]->
s.real, 0, -b, b_mag);
380 zaddeq(&c, &c_mag,
set[1]->
s.real, 0, -c, c_mag);
400 DEBUG(1) fprintf(stderr, "@@@ (%.15
g) -vs- (%.15
g)\n", b, c);
402 if (b < set[0]->
s.real || b > set[2]->
s.real) {
404 if (c <
set[0]->
s.real || c >
set[2]->s.real) {
405 DEBUG(1) fprintf(stderr, "@@@ both are junk\n");
407 new->
s.real = (set[0]->
s.real + set[1]->
s.real) / 2.0;
409 new->
s.real = (set[1]->
s.real + set[2]->
s.real) / 2.0;
411 if (
FABS(
set[1]->
s.real - c) <
FABS(
set[1]->
s.real - b)) {
412 DEBUG(1) fprintf(stderr, "@@@ mix
w/second (c)\n");
413 new->
s.real = (set[1]->
s.real + c) / 2.0;
415 DEBUG(1) fprintf(stderr, "@@@ mix
w/first (b)\n");
416 new->
s.real = (set[1]->
s.real + b) / 2.0;
421 DEBUG(1) fprintf(stderr, "@@@ take second (c)\n");
426 if (c <
set[0]->
s.real || c >
set[2]->s.real) {
427 DEBUG(1) fprintf(stderr, "@@@ take first (b)\n");
432 DEBUG(1) fprintf(stderr, "@@@ push -- first (b)\n");
435 DEBUG(1) fprintf(stderr, "@@@ push -- first (b)\n");
#define ERROR(CODE, MESSAGE)