issue with tgammaf

Keith Packard
Wed Jan 13 06:38:38 GMT 2021

Paul Zimmermann <> writes:

> In summary, the old code (__OBSOLETE_MATH_DEFAULT=1) is always better in terms
> of accuracy, with huge differences for some functions (cos, exp, exp10, exp2,
> log, log2, sin, pow).

Thanks so much for your evaluation. It's very good to know that by
selecting the original SunPro math functions we're not losing anything
in precision while we target machines with less capable hardware.

Are you able to share the code which performs these tests? I'd love to
be able to run these on a regular basis to ensure that no regressions
occur as we maintain the code.

This also provides a potential starting point for someone interested in
improving the accuracy of this library -- we could clearly use better
bessel and gamma functions.

> For bivariate functions (atan2, hypot, pow), the tests are not
> exhaustive.

Yeah, the search space is a bit large :-)

> tgamma:
> Total: errors=2028164922 (47.41%) errors2=1833526367 maxerr=2.39e+02 ulp(s)
> Total: errors=2026865970 (47.38%) errors2=1832940352 maxerr=2.39e+02 ulp(s)

Given that around half of the possible input values (> 35, or near
negative integers) generate an overflow, it seems like tgamma
essentially *never* gives us an accurate finite result...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <>

More information about the Newlib mailing list