From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by sourceware.org (Postfix) with ESMTPS id 5C856386F81C for ; Thu, 27 Aug 2020 17:44:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C856386F81C Received: by mail-vs1-xe2c.google.com with SMTP id y3so2610919vsn.1 for ; Thu, 27 Aug 2020 10:44:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=/fSQlfUxKCvkEd/qMeJ9UwP1qrornvSXkV1WSiUkFK8=; b=QijUi2en+/ixR29xlIfD9rCczHgps/TY0STSeMacfefmr2MgHiWwd/jnDFsOStv1gz YeMmSFZSMO3y38tOyuQOJtApNkSTrARKDZjJuOFHpWRGn/36UVhmBgortspeX97p9/nj lLRBunlSPFQhDF3hj0RNhWW+0LAQL+UdM1uDQ76F2oldOqH2mFXz67+DA1fRWc0+9Wk8 PMjn5r+wVtjXiLSY6QPg8FHS9inIGWUVxfOcE99Dwq6S94aQ2bXJrnRyvof1VAllrvqf PyvkCqvos6qWE7RU2eEEBab/PZCqxVVjRBTFw1c3VR2/mQj48iw7NuzJ4znVRq0J2iUd bAMg== X-Gm-Message-State: AOAM530xbBJxUMXJnGfHdhaFelnTUT2s6gKLoQS4KGD0ybWAbRWngi/z WR6QghVb0yzUQ/ate9BticNbnYl0j+oNcmlfusTVUQnDjzjg X-Google-Smtp-Source: ABdhPJwQbjXzJcZoPkCa0k6Pxwe4lz+vY4UJnIB4VpzPJmZOl13ZlD1kEqEgpIkR9XW3rq5d9dvqTbUbFEAEs9LnNkA= X-Received: by 2002:a67:12c7:: with SMTP id 190mr12663198vss.180.1598550240778; Thu, 27 Aug 2020 10:44:00 -0700 (PDT) MIME-Version: 1.0 References: <20200826170357.2551683-1-keithp@keithp.com> In-Reply-To: From: C Howland Date: Thu, 27 Aug 2020 13:43:49 -0400 Message-ID: Subject: Re: Fw: [PATCH 0/3] libm: Clean up gamma functions To: newlib@sourceware.org X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 17:44:03 -0000 > ------------------------------ > *From:* Newlib on behalf of Keith Packard > via Newlib > *Sent:* Wednesday, August 26, 2020 1:03 PM > *To:* newlib@sourceware.org > *Subject:* [PATCH 0/3] libm: Clean up gamma functions > > EXTERNAL EMAIL - This email originated from outside of CACI. Do not click > any links or attachments unless you recognize and trust the sender. > > > > > > This series cleans up some API oddities and inaccuracies in > errno/exception reporting from the various gamma related functions. > With this series applied, newlib now matches the POSIX spec (and glibc) > for tgamma/lgamma functions. I've left the 'gamma' functions BSD > compatible (tgamma instead of lgamma) to avoid changing the API. > > [PATCH 1/3] libm: Fix sign value returned from __ieee754_lgamma*_r(-0) > > Following the C spec, gamma(-0) should be -INFINITY rather than > +INFINITY, so the *signgamp value in lgamma should be -1 > rather than +1 for this case. > What C spec? Neither C99 nor C11 say so that I see for lgamma(). POSIX makes the direct statement "If x is a non-positive integer, a pole error shall occur and lgamma(), lgammaf(), and lgammal() shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively." 0, regardless of sign, falls under that. https://pubs.opengroup.org/onlinepubs/9699919799/functions/lgamma.html Additionally, the Linux lgamma man page, using GLIBC, says the same thing as quoted from POSIX (not word for word, but the identical result). (POSIX does require the +-0 +-INFINITY for tgamma(). Did these get crossed up?) Craig > > [PATCH 2/3] libm: Remove __ieee754_gamma_r variants > > Back in 2002, a patch changed the various gamma functions so > that the returned abs(gamma) instead of the ln of gamma. This > left the _r variants in place, with their extra parameter to > return the sign of the resulting value. This doesn't make any > sense to me and looks like it was just a mistake. I've changed > the __ieee754_gamma functions to apply the sign value locally > and eliminated the gamma_r versions as those are no longer useful. > > [PATCH 3/3] libm: Adjust errno/exception values for gamma/lgamma > > There's a pretty detailed discussion in the commit message > here, the short version is that tgamma and lgamma are > specified with different errno/exception behaviour for > one class of inputs (negative integers). >