Skip to content

Commit

Permalink
Merge pull request scipy#8711 from pvanmulbregt/norminvgauss_overflow
Browse files Browse the repository at this point in the history
ENH: remove an avoidable overflow in scipy.stats.norminvgauss.pdf()
  • Loading branch information
ev-br authored Apr 12, 2018
2 parents b21e246 + dcd56ce commit 8d155c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scipy/stats/_continuous_distns.py
Original file line number Diff line number Diff line change
Expand Up @@ -3258,7 +3258,7 @@ def _argcheck(self, a, b):
def _pdf(self, x, a, b):
gamma = np.sqrt(a**2 - b**2)
fac1 = a / np.pi * np.exp(gamma)
sq = np.sqrt(1 + x**2)
sq = np.hypot(1, x) # reduce overflows
return fac1 * sc.k1e(a * sq) * np.exp(b*x - a*sq) / sq

def _rvs(self, a, b):
Expand Down

0 comments on commit 8d155c4

Please sign in to comment.