diff --git a/test/math/remez-solver.h b/test/math/remez-solver.h index 4d3f7974..58d9e630 100644 --- a/test/math/remez-solver.h +++ b/test/math/remez-solver.h @@ -154,7 +154,6 @@ public: if (i < ORDER + 1) b = zeroes[i]; - printf("Error for [%g..%g]: ", (double)a, (double)b); for (;;) { real c = a, delta = (b - a) >> 3; @@ -183,7 +182,6 @@ public: if (e > final) final = e; control[i] = (a + b) >> 1; - printf("%g (at %g)\n", (double)e, (double)control[i]); break; } } @@ -290,7 +288,7 @@ public: an[i] *= k2p[i]; } - printf("Final polynomial:\n"); + printf("Polynomial estimate:\n"); for (int j = 0; j < ORDER + 1; j++) { if (j) diff --git a/test/math/remez.cpp b/test/math/remez.cpp index 1f0e0832..59750a11 100644 --- a/test/math/remez.cpp +++ b/test/math/remez.cpp @@ -24,22 +24,22 @@ using namespace std; #include "remez-solver.h" /* The function we want to approximate */ -static real myfun(real const &x) +real myfun(real const &y) { - real y = sqrt(x); - return (sin(y) - y) / (x * y); + real x = sqrt(y); + return (sin(x) - x) / (x * y); } -static real myerr(real const &x) +real myerr(real const &y) { - real y = sqrt(x); - return re(x * y); + real x = sqrt(y); + return sin(x) / (x * y); } int main(void) { - RemezSolver<4> solver; - solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 15); + RemezSolver<6> solver; + solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 40); return EXIT_SUCCESS; }