avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: E. Weddington
Subject: [avr-libc-dev] 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:

> address@hidden 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
> c/libm/fplib/cos.S?rev=HEAD&content-type=text/plain
> 
> http://savannah.nongnu.org/cgi-bin/viewcvs/*checkout*/avr-libc/avr-lib
> c/libm/fplib/acos.S?rev=HEAD&content-type=text/plain
> 
> 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:
> 
> address@hidden
> 

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 





reply via email to

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