jatinchowdhury18 / ADAA

Experiments with Antiderivative Antialiasing
BSD 3-Clause "New" or "Revised" License
72 stars 8 forks source link

Typo in ADAA2? #2

Open amethystdeceiver opened 2 years ago

amethystdeceiver commented 2 years ago

Hi Jatin,

First of all, thank you for the awesome work that you do!

I think I've spotted a typo here: https://github.com/jatinchowdhury18/ADAA/blob/6a0f311dac7c2f451a623bb492e1c8a9d135f169/src/ADAA/ADAA2.h#L60

Shouldn't it be like so:

double xBar = 0.5 * (x + x2);
double delta = xBar - x1;

And then x1 instead of x in the first nlFuncAD2() call? Which could be reused from the previous calculation step?

return illCondition ?
            nlFunc (0.5 * (xBar + x1)) :
            (2.0 / delta) * (nlFunc_AD1 (xBar) + (nlFunc_AD2 (x1) - nlFunc_AD2 (xBar)) / delta);
jatinchowdhury18 commented 2 years ago

Hi! Thanks for the kind words, and for the question about the 2nd-order ADAA equation.

From looking at the code again, it looks like you're correct. I had gotten a little bit mixed up from the notation used in the paper I was using for reference (linked here).

I'll push a fix in a few minutes.