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: "Carlos O'Donell" <carlos at redhat dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Rich Felker <dalias at aerifal dot cx>, 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: Tue, 09 Apr 2013 22:45:47 -0400
- Subject: Re: libm-test.inc: Computing ulps near FP_ZERO.
- References: <5160A4D7 dot 9080802 at codesourcery dot com> <516183BD dot 6060700 at redhat dot com> <5161AADF dot 2040403 at codesourcery dot com> <5161FA1A dot 5060100 at redhat dot com> <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>
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
(2) Load Wolfram's Alpha at: http://www.wolframalpha.com/
and run `cos(<significant digits from (1)>)` and click
`more digits' to get a sufficiently precise representation
for your long double type, click on the `A' and cut and
paste the answer.
cos(1.5707963267948966192564044797030931022163713350892066955566406250000000000000000000000000000000000000e+00)
= -2.508278806334166011778663540165378506916569872238747334316923792121510019488616529065465240162807803475378148593... × 10^-20
Compare the result to that above.
If they are the same then it will work.
If they are the same then it means the particular type has the
same error when rounding PI/2 to a representable value.
Cheers,
Carlos.