[Bug 713985] Re: [armel] Function tgammal has precision issues in version 2.12.1-0ubuntu10.2 on ARM

Dima Pasechnik 713985 at bugs.launchpad.net
Thu Feb 2 04:49:48 UTC 2012


This boils down to eglibc working with 8-byte floats on ARM, even if it's declared long double.
To see this behaviour on x86, build and run the following:

#include <stdio.h>
#include <math.h>
int main ()
{
  double x = 6.0;
  printf("sizof(double)=%d\n",sizeof(double));
  printf("lgamma (%.20f)=%.20f\n", x, lgamma(x));
  printf("tgamma (%.20f)=%.20f\n", x, tgamma(x));
  printf("exp(lgamma) (%.20f)=%.20f\n", x, exp(lgamma(x)));
  return 0;
}

On eglibc you'll see:

sizof(double)=8
lgamma (6.00000000000000000000)=4.78749174278204581157
tgamma (6.00000000000000000000)=119.99999999999997157829
exp(lgamma) (6.00000000000000000000)=119.99999999999997157829

On a better libc (MacOSX 10.6 on x86_64):

sizof(double)=8
lgamma (6.00000000000000000000)=4.78749174278204492339
tgamma (6.00000000000000000000)=120.00000000000000000000
exp(lgamma) (6.00000000000000000000)=119.99999999999987210231

So eglibc does a bad job computing gamma() on double (i.e. on 8-byte
floats) in this range of values (around 6.0).

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to eglibc in Ubuntu.
https://bugs.launchpad.net/bugs/713985

Title:
  [armel] Function tgammal has precision issues in version
  2.12.1-0ubuntu10.2 on ARM

Status in Linaro Toolchain Miscellanies:
  New
Status in “eglibc” package in Ubuntu:
  Confirmed

Bug description:
  Consider the following test program :
  #include <stdio.h>
  #include <math.h>
   
  int
  main (int argc,
        char* argv[])
  {
    long double x = 6.0;
    printf("tgammal (%.20Lf)=%.20Lfn", x, tgammal(x));
    return 0;
  }

  When run on 2.12.1-0ubuntu10.2, the result is :
  tgammal (6.00000000000000000000)=119.99999999999997157829
  while when run on 2.11.2-11 (glibc's unstable), the result is :
  tgammal (6.00000000000000000000)=119.99999999999999998612

  The second result is acceptable, while the second isn't. This makes
  sage (http://www.sagemath.org) unhappy...

To manage notifications about this bug go to:
https://bugs.launchpad.net/linaro-toolchain-misc/+bug/713985/+subscriptions




More information about the foundations-bugs mailing list