New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 733844 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

ec: Optimize acos() function

Project Member Reported by sha...@chromium.org, Jun 15 2017

Issue description

Moved from b/35530726:

math_util.c arc_cos() is inefficient.

We should consider using a Taylor Series approximation in place of the existing algorithm. It will save RAM (we can dump the existing 36-entry LUT) and be faster + more accurate. 

See http://www.coranac.com/documents/arctangent/ - "2.6 atanTonc : homegrown Taylor expansion" for an atan() example.
 
Owner: philipchen@chromium.org
Here is what I found:
1) acos(x) = pi/2 - asin(x). So we can approximate asin to get acos.
2) The error from Taylor series approximation for asin(x) increases up to 0.3 rad when x is close to 1.
I tried another approximation called Chebyshev - it can keep the error within 0.036.
But it's kind of computation intensive (there is a division).
You can check my formulas and calculation results here: 
https://docs.google.com/a/google.com/spreadsheets/d/1bdyBJIiXumXCG4m0oeYz2_HATEWrFZoR8yRcFfFMqaE/edit?usp=sharing
3) Weighing up pros and cons, I think current LUT method is not bad as long as we use binary search to replace linear search.

Status: WontFix (was: Untriaged)
As described in #2, it's probably not worth fixing.

Sign in to add a comment