Changeset 1070 for trunk/test/math


Ignore:
Timestamp:
Nov 15, 2011, 9:19:32 PM (10 years ago)
Author:
sam
Message:

tutorial: replace log() calls with fast approximations.

File:
1 edited

Legend:

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

    r1069 r1070  
    3131real myfun(real const &y)
    3232{
    33 real k1024 = 1024;
    34 real klog32 = log((real)32);
    35 return (y - k1024) / log2(log(sqrt(y))/klog32);
    3633    real x = sqrt(y);
    3734    return (sin(x) - x) / (x * y);
     
    4037real myerr(real const &y)
    4138{
    42 return myfun(y);
    43 return real::R_1;
    4439    real x = sqrt(y);
    4540    return sin(x) / (x * y);
     
    4843int main(int argc, char **argv)
    4944{
    50     RemezSolver<3> solver;
    51     solver.Run((real)(1024.001), (real)(1024 * 1024), myfun, myerr, 40);
     45    RemezSolver<2> solver;
     46    solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 40);
    5247
    5348    return EXIT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.