https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63488
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Oct 09, 2014 at 06:27:08PM +0000, zimmerma+gcc at loria dot fr wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63488 > > --- Comment #7 from Paul Zimmermann <zimmerma+gcc at loria dot fr> --- > I agree that near zeroes we can expect large errors. However for > other functions I got only small errors in ulps, maybe I was unlucky. > Also the ultimate goal is to get correct rounding, even near zeroes. > I suspect you got lucky :-) IIRC my testing correctly, exhaustive testing of values in each interval shows lgammaf(x) for x < 0 and not an integer also has major accuracy issues: Interval: Max ULP Value [-1.10000e+01, -1.00000e+01): 6.72889 -1.0000009e+01 [-1.00000e+01, -9.00000e+00): 83.4928 -9.0000029e+00 [-9.00000e+00, -8.00000e+00): 24615.2 -8.0000248e+00 [-8.00000e+00, -7.00000e+00): 22575.7 -7.9999752e+00 [-7.00000e+00, -6.00000e+00): 100393. -6.0013852e+00 [-6.00000e+00, -5.00000e+00): 36966.5 -5.0082183e+00 [-5.00000e+00, -4.00000e+00): 324309. -4.0393620e+00 [-4.00000e+00, -3.00000e+00): 2981098 -3.1435809e+00 [-3.00000e+00, -2.00000e+00): 7497618 -2.4570248e+00 [-2.00000e+00, -1.00000e+00): 4.18718 -1.7313151e+00 [-1.00000e+00, -4.76837e-07): 3.46651 -3.5002786e-01 troutmask:fvwm:kargl[209] ./testf -a -3.1435809e+00 libm: -2.38418579e-07, 1 mpfr: -1.96054615e-07, 1 The relevant code in testf is (RND is round-to-nearest). x = (float)strtof(optarg, NULL); y = lgammaf_r(x,&s); mpfr_inits2(DBL_MANT_DIG, t1, t2, NULL); mpfr_set_d(t1, (double)x, RND); mpfr_lgamma(t2, &si, t1, RND); printf("libm: %.8e, %d\n", y, s); mpfr_printf("mpfr: %.8Re, %d\n", t2, si); mpfr_clears(t1, t2, NULL);