Relative
exp2(x)
approximation errors in interval [-1:1]:
That's a miniscule range to approximate, given the valid range of this function. Here are the errors of
bse_approx3_exp2() at mostly integer steps with some omissions for brevity:
-2.0, +0.00000000000000000
-1.5, -0.00016133294256113
-1.0, +0.00000000000000000
-0.5, -0.00032266588512226
+0.0, +0.00000000000000000
+0.5, -0.00112351661969536
+1.0, +0.00000000000000000
+1.5, -0.00224703323939071
+2.0, +0.00000000000000000
+2.5, -0.00449406647878142
+7.0, +0.00000000000000000
+11.0, +0.00000000000000000
+16.0, +0.00000000000000000
+32.0, +0.00000000000000000
+40.0, +0.00000000000000000
+48.0, +0.00000000000000000
+54.0, +0.00000000000000000
+64.0, +0.00000000000000000
+127.0, +0.00000000000000000
Now the same for fast_exp2<2>():
-2.0, +0.00011078548906696
-1.5, -0.00060979588254370
-1.0, +0.00022157097813391
-0.5, -0.00121959176508741
+0.0, +0.00044314195626782
+0.5, +0.00243918353017435
+1.0, +0.00088628391253565
+1.5, +0.00487836706034869
+2.0, +0.00177256782507129
+2.5, +0.00975673412069738
+7.0, +0.05672217040228134
+11.0, +0.90755472643650137
+16.0, +29.04175124596804380
+32.0, +1903280.20965576171875000
+40.0, +487239733.671875
+48.0, +124733371820
+54.0, +7982935796480
+64.0, +8174526255595520
+127.0, +75396696880394894980022595129180160
I.e. a pure Remez approximation works allmost as well as approxX_exp2 while using one less addmul, but only within -1:+1. I've discarded that approach when I wrote approxX_exp2, because outside of that range the error becomes gigantic. Above, I'm comparing approx3_exp2 with fast_exp2<2>, to show that with just one extra addmul, those giant errors can be avoided (which even fast_exp2<9> cannot accomplish) if the integer part and the fractional part are approximated separately.
Considering that fast_exp2<>() are not even minimizing the error at exactly -1, +1, or at 0 at the very least, I'd at most add them as rough approximations to be used only when the input range is known to be -1..+1 (which is not the case for general audio signals in BSE). For that it might be named fast_narrow_exp2<>() or similar, but I think fast_exp2<>() is better used if we rename the current bse_approxX_exp2 functions.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.