<h3 dir="auto">Description</h3>
<p dir="auto"><code class="notranslate">jax.scipy.special.betaln</code> becomes very inaccurate for large inputs.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/391217/202057219-814b0ca5-ea8c-41c0-8f5c-748e19fa8fe0.png"><img width="608" alt="Screen Shot 2022-11-15 at 4 54 10 PM" src="https://user-images.githubusercontent.com/391217/202057219-814b0ca5-ea8c-41c0-8f5c-748e19fa8fe0.png" style="max-width: 100%;"></a></p>
<p dir="auto">The image is comparing jax, scipy, and a jax version I made that parallels scipy's version (at the expense of duplicated work, due to the evaluation of both branches).</p>
<p dir="auto">The more accurate jax version can be found <a href="https://gist.github.com/imh/b6e3e7e2ea3224e365360cea85578240">here</a>. I would be happy to open up a PR for it, if someone could answer the following:</p>
<ul dir="auto">
<li>If this went in <code class="notranslate">jax._src.scipy.special</code>, where should I import <code class="notranslate">jnp.where</code> from to avoid circular dependencies?</li>
<li>Since I just ported (two branches of) of scipy's version of <code class="notranslate">betaln</code>, I expect there may be be license issues including it in jax. Is that the case? Scipy's license is linked in the ported version.</li>
</ul>
<h3 dir="auto">What jax/jaxlib version are you using?</h3>
<p dir="auto">0.3.23</p>
<h3 dir="auto">Which accelerator(s) are you using?</h3>
<p dir="auto">CPU</p>
<h3 dir="auto">Additional system info</h3>
<p dir="auto">MacOS 12.6</p>
<h3 dir="auto">NVIDIA GPU info</h3>
<p dir="auto"><em>No response</em></p>
<p dir="auto">Analogous to <a href="https://github.com/HIPS/autograd/blob/c6f630a5ec18bd30f1485bc0dbbccb8664c77510/autograd/differential_operators.py#L192-L202"><code class="notranslate">checkpoint</code> in Autograd</a> (but handling closed-over tracers).</p>