Skip to content

Commit

Permalink
Use limit->∞ of formula (= -0.5) when formula overflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeonus committed Jun 20, 2018
1 parent 1f001df commit 6a7704d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,10 @@ def sigmoid(x):

boost = (1 - sigmoid(25 * (cruiseKls - 1))) / 4
drop = (-1 - sigmoid(50 * (cruiseKls - 4))) / 4
penalty = (-1 + 1 / (cruiseKls + 1) ** ((cruiseKls + 1) / 4)) / 2
try:
penalty = (-1 + 1 / (cruiseKls + 1) ** ((cruiseKls + 1) / 4)) / 2
except OverflowError:
penalty = -0.5

multiplier += (penalty + boost + drop) * lsPenalty

Expand Down

1 comment on commit 6a7704d

@eyeonus
Copy link
Owner Author

Choose a reason for hiding this comment

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

Fix #6

Please sign in to comment.