Re: [tim-janik/beast] BSE: bsemathsignal: add approximations: Bse::fast_log2 and Bse::fast_exp2 (#124)



I just pushed a new version of the 2^x approximation as fast_exp2() to master and removed the old approximations. Commit 7d919e9 still has the old functions, and a comparative benchmark.
The approximation is based on the 5th order polynomial with minimal relative error, approximating 2^x within [-0.5...+0.5], generated with Sollya. The result is almost as accurate as the old bse_approx6_exp2(), although fast_exp() uses only float arithmetic. It is also significantly faster than the old functions and the optimized exp2f() variant recently added to glibc and musl (ARM-software/exp2f).

git checkout 7d919e98bb116f98a6b05e56f8a05edb6825692e && make 
BSE_TEST=slow out/tests/suite1 fast_math_test  fast_math_bench 
  RUN…     fast_math_test
  PASS     fast_math_test
  RUN…     fast_math_bench
  BENCH    fast_exp2          # timing: fastest=0.000392s calls=458605760.0/s diff=0.00000033028512169686 (@0.734155)
  BENCH    arm_exp2f          # timing: fastest=0.000532s calls=338185006.7/s diff=0.00000005979062378536 (@0.958382)
  BENCH    exp2f              # timing: fastest=0.000650s calls=276832337.1/s diff=0.00000005979062378536 (@0.958382)
  BENCH    bse_approx5_exp2   # timing: fastest=0.000768s calls=234464124.9/s diff=0.00000458521965707170 (@0.500000)
  BENCH    bse_approx6_exp2   # timing: fastest=0.000847s calls=212474853.5/s diff=0.00000022838359092781 (@0.500000)
  BENCH    bse_approx7_exp2   # timing: fastest=0.000854s calls=210667974.8/s diff=0.00000000994037496760 (@0.500000)
  PASS     fast_math_bench


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]