Skip to content

Propagate nan in ei_asymp()#672

Merged
skirpichev merged 1 commit into
mpmath:masterfrom
skirpichev:ei_asympt-nan
Mar 30, 2023
Merged

Propagate nan in ei_asymp()#672
skirpichev merged 1 commit into
mpmath:masterfrom
skirpichev:ei_asympt-nan

Conversation

@skirpichev

Copy link
Copy Markdown
Collaborator

Closes #480
Closes #481
Closes #482
Closes #483
Closes #484
Closes #487

@cbm755 cbm755 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! +1 to merge

Comment thread mpmath/math2.py
k += 1
t *= k*r
s += t
if abs(t) < 1e-16:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or

diff --git a/mpmath/math2.py b/mpmath/math2.py
index 302e25f..e54c0d1 100644
--- a/mpmath/math2.py
+++ b/mpmath/math2.py
@@ -507,7 +507,7 @@ def ei_asymp(z, _e1=False):
     while 1:
         t *= k*r
         s += t
-        if abs(t) < 1e-16:
+        if not (abs(t) >= 1e-16):
             break
         k += 1
     v = s*exp(z)/z

@skirpichev skirpichev merged commit 8650604 into mpmath:master Mar 30, 2023
@skirpichev skirpichev deleted the ei_asympt-nan branch March 30, 2023 02:15
@skirpichev skirpichev added this to the 1.4 milestone May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants