2008/8/29 Dan Kegel dank@kegel.com:
Henri wrote:
glibc implements acos() as the FPU equivalent of atan2(sqrt(1 - x ^ 2), x).
I just looked, and there are several implementations of acos in glibc, and they all seem to very carefully choose how to do it based on how close x is to 1.
The specific implementation I was talking about is http://sources.redhat.com/git/?p=glibc.git;a=blob;f=sysdeps/i386/fpu/e_acos.... it's NetBSD derived, and it seems at least NetBSD and OpenBSD use the same or a similar implementation. I couldn't quickly find what FreeBSD uses, but I wouldn't be surprised if it uses something like that as well.
This should be fixed on the glibc side as well
Indeed. Have you filed a bug report against glibc yet? I didn't see one at http://sourceware.org/bugzilla/ Please be sure to attach a simple C program that reproduces the problem, or better yet, a patch to add a test case to their test suite.
I tried to create an account on their bugzilla yesterday, but for some reason I never got the confirmation mail. I'll probably try again in a few days. http://sources.redhat.com/bugzilla/show_bug.cgi?id=2540 looks like a similar issue.