This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: libm-test.inc: Computing ulps near FP_ZERO.
- From: Rich Felker <dalias at aerifal dot cx>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Andreas Schwab <schwab at linux-m68k dot org>, Brooks Moses <brooks_moses at mentor dot com>, GNU C Library <libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Andreas Jaeger <aj at suse dot com>, Thomas Schwinge <thomas at codesourcery dot com>, David Miller <davem at davemloft dot net>
- Date: Wed, 10 Apr 2013 01:31:01 -0400
- Subject: Re: libm-test.inc: Computing ulps near FP_ZERO.
- References: <51620F35 dot 5080101 at codesourcery dot com> <51634CA1 dot 4050006 at redhat dot com> <51636912 dot 10702 at codesourcery dot com> <5163710F dot 9080500 at mentor dot com> <20130409020954 dot GT20323 at brightrain dot aerifal dot cx> <51643640 dot 5090900 at redhat dot com> <20130409160141 dot GX20323 at brightrain dot aerifal dot cx> <51645137 dot 3030905 at redhat dot com> <m2fvyz1f0a dot fsf at igel dot home> <5164D25B dot 9090406 at redhat dot com>
On Tue, Apr 09, 2013 at 10:45:47PM -0400, Carlos O'Donell wrote:
> On 04/09/2013 07:05 PM, Andreas Schwab wrote:
> > "Carlos O'Donell" <carlos@redhat.com> writes:
> >
> >> +#if defined TEST_LDOUBLE
> >> + TEST_f_f (cos, M_PI_2l, -2.50827880633416601177866354016537e-20L);
> >> +#endif
> >
> > Does that work for all long double types?
>
> I doubt it. I need help fixing that.
>
> See my post here:
> http://sourceware.org/ml/libc-alpha/2013-04/msg00273.html
>
> As I mentioned in the previous email this is dependent
> on the rounding error representing PI/2 for your type.
>
> If you have a build of something with an alternate long double type,
> say IBM double double for Power PC could you try the following?
>
> (1) Compile and run:
>
> cat >> test.c <<EOF
> #include <stdlib.h>
> #include <stdio.h>
> #include <math.h>
>
> int
> main (void)
> {
> printf ("%.100Le\n", (long double)(M_PIl/2.0L));
> return 0;
> }
> EOF
> gcc -D_GNU_SOURCE -o test test.c
> ../test
> 1.5707963267948966192564044797030931022163713350892066955566406250000000000000000000000000000000000000e+00
If you use %g rather than %e you can avoid the excess zeros at the
end.
Rich