This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
correct rounding or not?
- From: paul zimmermann <Paul dot Zimmermann at inria dot fr>
- To: libc-alpha at sourceware dot org
- Date: Wed, 29 Jan 2020 17:36:17 +0100
- Subject: correct rounding or not?
Hi,
in sysdeps/ieee754/dbl-64 one can find code coming from IBM's
Accurate Mathematical Library (libultim), with comments claiming
for correct rounding, for example in s_sin.c one can read around
lines 194-197:
/*******************************************************************/
/* An ultimate sin routine. Given an IEEE double machine number x */
/* it computes the correctly rounded (to nearest) value of sin(x) */
/*******************************************************************/
...
__sin (double x)
However, it appears that the __sin function is not correctly rounded,
for example for x=8.5546900000006210e-01 it gives 7.5487859961632653e-01
whereas the correct rounding is 7.5487859961632664e-01 (according to mpfr).
Maybe the original code from libultim was modified, in particular the
code that guarantees correct rounding (rounding test + slow path) was
removed?
Anyway, I believe the comments should be modified to accurately
describe what the current code does.
Best regards,
Paul Zimmermann