This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libm-test.inc: Computing ulps near FP_ZERO.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]