Efficient way to implement trigonometry functions?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-02-02 10:28 AM
Posted on February 02, 2013 at 19:28
Hello,
I'm working on the STM32F4, and in my application i need to use atan2 and exp a very large number of times.In my initial implementation i used the stlib for atan2 and exp. Unfortunately, in the current state my algorithm is too slow to run at the required frequency.Does anyone have a reference to how these functions are implemented (I'm using GCC 4.7).Also, does anyone know of a more efficient method to implement these functions? (Taylor series, etc)ThanksAlex #stm32f4-atan2-exp
Labels:
- Labels:
-
STM32F4 Series
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-02-02 12:17 PM
Posted on February 02, 2013 at 21:17
The fastest way is to use a lookup table.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-02-02 2:27 PM
Posted on February 02, 2013 at 23:27
To stand some chance of using the FPU you'd need to use the float (32-bit) version
float atan2f (float y, float x)
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-02-02 3:22 PM
Posted on February 03, 2013 at 00:22
Thanks a ton.
It dropped from ~4.7k cycles to 400 :)Cheers