This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Results of cos(pi/2) tests are dependent on error rounding pi/2 to a type.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>, "libc-ports at sourceware dot org" <libc-ports at sourceware dot org>
- Date: Thu, 11 Apr 2013 08:59:49 -0400
- Subject: Results of cos(pi/2) tests are dependent on error rounding pi/2 to a type.
Community,
I've recently fixed the cos(pi/2) tests to expect the correct
result from the rounding of pi/2. The tests previously expected
cos(M_PI_2l) to return 0.0, but this is naive. The actual answer
is a non-zero value almost equal to the error in rounding pi/2
to the floating point representation.
The first derivitive of cos(pi/2) is ~1, therefore any error
in pi/2 has a direct and linear effect on the result of the answer
either causing it to be slightly more than 0 or slightly less than
zero. The exact answer to cos(pi/2) is highly dependent on the type
used.
I've tried to take into account all of the types, but in the event
that I've made a mistake please come to me and I'll help fix it.
Cheers,
Carlos.