[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


> 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..

Jamie Morken

avr-gcc-list at http://avr1.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]