[
https://issues.apache.org/jira/browse/MATH-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13442592#comment-13442592
]
Sébastien Brisard commented on MATH-849:
----------------------------------------
{quote}
Why can't you keep a single implementation (the one that works in both ranges)?
IOW, why can't the new implementation be used for issue MATH-753?
{quote}
The NSWC implementation does not propose one unique approximation for the whole
x > 0 range. There is an approximation for smallish values x < 20, and another
one for large-ish values. So I'm merely proposing to replace the NSWC approx
for large values with the Lanczos approximation, which on the other hand is
known to be inaccurate near the zeros of log(Gamma) (that's pretty clear on my
graph).
For large values of x, both methods (Lanczos or NSWC) are equivalent in terms
of accuracy, but Lanczos lends itself to a better fix of MATH-753 (reordering
some operations in order to avoid some catastrophic cancellations). That's why
I propose to keep Lanczos for large values of the argument.
{quote}
By the way, did you benchmark the alternative implementations? If there is a
"big" difference, maybe that some users will be willing to trade off accuracy
for performance. That could be indicated in the Javadoc.
{quote}
Haven't looked at it yet, but will do.
> Precision improvement in class Gamma
> ------------------------------------
>
> Key: MATH-849
> URL: https://issues.apache.org/jira/browse/MATH-849
> Project: Commons Math
> Issue Type: Improvement
> Reporter: Sébastien Brisard
> Assignee: Sébastien Brisard
> Priority: Minor
> Labels: accuracy, special-functions
> Fix For: 3.1
>
> Attachments: MATH-849-Lanczos_vs_NSWC.zip, MATH-849.patch,
> MATH-849.zip
>
>
> New unit tests (see below) show that (on the set of values tested) the
> current accuracy of {{Gamma.logGamma(double)}} is about 130 ulps.
> The [NSWC Library of Mathematical
> Functions|http://www.dtic.mil/docs/citations/ADA476840] proposes an
> implementation of this function with much higher accuracy: on the same set of
> values, the error goes down to about 3 ulps.
> This library is available
> [here|http://www.ualberta.ca/CNS/RESEARCH/Software/NumericalNSWC/site.html],
> and is license-free [see this
> thread|http://markmail.org/thread/fg4y4dfdnfty5hov]. It is proposed to port
> this implementation in Commons-Math. This in turn could lead to a resolution
> of MATH-738.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira