avr-gcc-list
[Top][All Lists]

## Re: [avr-gcc-list] Problem with asin() and acos()

 From: E. Weddington Subject: Re: [avr-gcc-list] Problem with asin() and acos() Date: Wed, 02 Oct 2002 10:19:17 -0600

```On 2 Oct 2002 at 10:45, Joerg Wunsch wrote:

>
> > In a posting on the avr-gcc mailing list july 27th
> > Jamie Morken (address@hidden) describes
> > exactly the same problem.
> > What strokes me in Jamie's desciption is that he gets
> > the same (wrong) result as I did:
>
> Then it's probably really at fault.
>
> acos() calls asin(), and just adds Pi/2 to the result, so it's no
> surprise that both are incorrect.  Maybe this approach is error-prone
> for small numbers?
>
> At a glance, i don't quite understand the algorithm used.  You might
> want to have a look at the implementation of both functions under
>
> http://savannah.nongnu.org/cgi-bin/viewcvs/*checkout*/avr-libc/avr-lib
>
> http://savannah.nongnu.org/cgi-bin/viewcvs/*checkout*/avr-libc/avr-lib
>
> It's probably better to discuss this on the avr-libc developer's
> mailing list since it's actually a problem with the library, not
> the compiler:
>
>

I just did some research. The correct formula for acos(x) is:

acos(x) = (PI/2) - asin(x)

So acos.s is incorrect. Does anybody know if the implementation of
asin() is correct?

Eric

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

```