Skip to content

Commit

Permalink
Avoid one more overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed May 16, 2021
1 parent 87378cc commit 3a39cd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chemicals/dippr.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def EQ115(T, A, B, C=0, D=0, E=0, order=0):
DIPPR/AIChE
'''
if order == 0:
return exp(A+B/T+C*log(T)+D*T**2 + E/T**2)
return trunc_exp(A+B/T+C*log(T)+D*T**2 + E/T**2)
elif order == 1:
x0 = T**2
x1 = 1/x0
Expand Down
5 changes: 5 additions & 0 deletions tests/test_dippr.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ def test_EQ115_more():
d3_numerical = derivative(lambda T: EQ115(T, *args, order=2), 300.0, dx=1e-2)
assert_close(d3_analytical, 0.0007252940633608988, rtol=1e-13)
assert_close(d3_analytical, d3_numerical)

# Check case avoid overflow
kwargs = {'T': 400.05, 'A': 1.0, 'B': 1.0, 'C': 1.0, 'D': 1.0, 'E': 1.0, 'order': 0}
EQ115(**kwargs)



def test_EQ116_more():
Expand Down

0 comments on commit 3a39cd7

Please sign in to comment.