diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-10-28 15:46:30 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-10-31 23:22:02 -0400 |
commit | 2e77183461e11521a37f34e0c01581df762413fc (patch) | |
tree | 9bf1cbabee73c4f0ea2cba878138bb90704b6ba5 /libdimension/tests | |
parent | 6aafcec6823d2b99c40b2ce85ed6581b6c3af3ea (diff) | |
download | dimension-2e77183461e11521a37f34e0c01581df762413fc.tar.xz |
Use Rouillier and Zimmerman's version of the Uspensky algorithm.
Diffstat (limited to 'libdimension/tests')
-rw-r--r-- | libdimension/tests/polynomial.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libdimension/tests/polynomial.c b/libdimension/tests/polynomial.c index d66c975..b0d3b77 100644 --- a/libdimension/tests/polynomial.c +++ b/libdimension/tests/polynomial.c @@ -32,13 +32,13 @@ main(void) dmnsn_die_on_warnings(true); double poly[6], x[5]; - /* poly[] = (x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100) */ - poly[5] = 1.0; - poly[4] = -107.5801; - poly[3] = 770.2260432; - poly[2] = -1215.2863928; - poly[1] = -646.270936; - poly[0] = 1447.8216; + /* poly[] = 2*(x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100) */ + poly[5] = 2.0; + poly[4] = -215.1602; + poly[3] = 1540.4520864; + poly[2] = -2430.5727856; + poly[1] = -1292.541872; + poly[0] = 2895.6432; size_t n = dmnsn_polynomial_solve(poly, 5, x); if (n != 4) { @@ -52,7 +52,7 @@ main(void) double evmin = dmnsn_polynomial_evaluate(poly, 5, x[i] - dmnsn_epsilon); double ev = dmnsn_polynomial_evaluate(poly, 5, x[i]); double evmax = dmnsn_polynomial_evaluate(poly, 5, x[i] + dmnsn_epsilon); - if (fabs(evmin) < ev || fabs(evmax) < ev) { + if (fabs(evmin) < fabs(ev) || fabs(evmax) < fabs(ev)) { fprintf(stderr, "--- Root %.15g is inaccurate! ---\n", x[i]); return EXIT_FAILURE; } |