Ignore:
Timestamp:
Oct 10, 2011, 3:33:15 AM (9 years ago)
Author:
sam
Message:

test: various improvements to the Remez exchange solver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/math/remez.cpp

    r1012 r1014  
    2727static real myfun(real const &x)
    2828{
    29     static real const a0 = real::R_1;
    30     static real const a1 = real(-11184811) >> 26;
    31     static real const b1 = real(-1) / real(6);
    32     static real const b2 = real(1) / real(120);
    3329    real y = sqrt(x);
    34     return sin(y) / y;
     30    return (sin(y) - y) / (x * y);
    3531}
    3632
    3733static real myerr(real const &x)
    3834{
    39     return real::R_1;
     35    real y = sqrt(x);
     36    return re(x * y);
    4037}
    4138
    42 int main(int argc, char **argv)
     39int main(void)
    4340{
    44     RemezSolver<6> solver;
    45     //solver.Run(0, 1, myfun, myfun, 15);
    46     solver.Run(exp((real)-100), real::R_PI * real::R_PI >> 2, myfun, myfun, 15);
    47     //solver.Run(-1, 1, myfun, myfun, 15);
    48     //solver.Run(0, real::R_PI * real::R_PI >> 4, myfun, myfun, 15);
     41    RemezSolver<4> solver;
     42    solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 15);
    4943
    5044    return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.