[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [avr-gcc-list] Problem with asin() and acos()

**From**: |
Jamie Morken |

**Subject**: |
Re: [avr-gcc-list] Problem with asin() and acos() |

**Date**: |
Tue, 01 Oct 2002 15:16:24 -0700 |

Hi,
>* Greetings,*
>* the acos() and asin() calls cause me some trouble,*
>* they return incorrect numbers as shown for acos in*
>* the listing below. tan(x), sin(x) and cos(x) are ok.*
I had the same problem with acos() so I used the below equivalent formula:
temp2 = acos(temp1);
is replaced with:
temp2 = atan2(temp1,sqrt(1-temp1*temp1));
This gives the correct answer.
Sorry I don't know what you would use for an asin() replacement off the top
of my head.
I always hated trigonometry..
cheers,
Jamie Morken
avr-gcc-list at http://avr1.org