lgamma_r and lgammaf_r return the wrong sign for -0.f

Steve Kargl sgk at troutmask.apl.washington.edu
Wed Sep 17 19:03:19 UTC 2014


On Fri, Sep 12, 2014 at 02:15:37PM -0700, enh via freebsd-numerics wrote:
> if I pass -0.f to lgammaf_r, the sign returned in *signgamp is 1. this
> is incorrect --- it should be -1.
> 
> both lgamma_r and lgammaf_r are affected, but the other special cases
> in those functions look fine to me.
> 
> this is fixed in OpenBSD and glibc, but FreeBSD and NetBSD both have
> the same bug.
> 
> patch below (whitespace mangled courtesy of gmail). i'd prefer to wait
> for this to be fixed in FreeBSD and pull down the fix rather than just
> fix it locally.
> 
> btw, it looks like you're missing coshl/sinhl/tanhl for ld128 now?
> (they've been removed from imprecise.c without having ld128
> implementations added afaics.)
> 
>  --elliott (Android libc maintainer)

I committed your patch along with the necessary changes to the
ld80/e_lgamma_r.c and ld128/e_lgamma_r.c.

Thanks for bug report.

-- 
Steve


More information about the freebsd-numerics mailing list