From 6a7704d532712a22bbacf08a09a714fdd600e721 Mon Sep 17 00:00:00 2001 From: eyeonus Date: Tue, 19 Jun 2018 19:13:59 -0600 Subject: [PATCH] =?UTF-8?q?Use=20limit->=E2=88=9E=20of=20formula=20(=3D=20?= =?UTF-8?q?-0.5)=20when=20formula=20overflows.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tradecalc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tradecalc.py b/tradecalc.py index 7014749d..01857335 100644 --- a/tradecalc.py +++ b/tradecalc.py @@ -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