-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Pythagorean identity to shrink sine table #21
Conversation
The sine table contribute a large code size. To optimize this, the Pythagorean identity has been applied to minimize the size of sine table. The adjustment decreases code size while preserving the accuracy of sine calculations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run clang-format -i
to ensure consistent indention.
}; | ||
|
||
/* | ||
* angles are measured from -2048 .. 2048 | ||
*/ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change this line. Minimize the necessary changes.
@ndsl7109256 Can you briefly explain how the Pythagorean identity can reduce the size of the table, or provide a comment in the code explaining how it works? And you can use the Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve the git commit message. In particular, make it grammatically correct.
As @jouae mentioned, prove that the proposed method is beneficial and maintains the desired precision. You may consider introducing the CORDIC method for sine computation without using expensive lookup tables. Check the following:
- Why the CORDIC algorithm lives rent-free in my head
- How to use the CORDIC to perform mathematical functions on STM32 MCUs
- 5th Order Polynomial Fixed-Point Sine Approximation
- A performance test for trigonometric functions, computed with the CORDIC method
- Simple C source for CORDIC
- How do Trigonometric functions work?
@ndsl7109256 For a Chinese explanation of |
The sine table contribute a large code size. To optimize this, the Pythagorean identity has been applied to minimize the size of sine table. The adjustment decreases code size while preserving the accuracy of sine calculations.