summaryrefslogtreecommitdiffstats
path: root/deco.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-08-21 17:19:32 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-21 09:27:53 -0700
commitd9b4f2b7e36d8891a34b8049eca8008c89382e2f (patch)
tree8aa809fb8936972ecc6dd0d979569fa531a47508 /deco.c
parent0f096d0e5375d3f70f877fb0c2c11e925a2b43e8 (diff)
downloadsubsurface-d9b4f2b7e36d8891a34b8049eca8008c89382e2f.tar.gz
Don't do Boyle compensation when still on first stop
There is nothing to compensate but we would hit a 0/0 numerical instability there. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'deco.c')
-rw-r--r--deco.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/deco.c b/deco.c
index 7b8d7c2be..16089e32b 100644
--- a/deco.c
+++ b/deco.c
@@ -362,6 +362,10 @@ void boyles_law(double next_stop_pressure)
{
int ci;
+ // This should be a tautology but prevents a numerical instability.
+ if (IS_FP_SAME(next_stop_pressure, first_stop_pressure))
+ return;
+
if (!first_stop_pressure)
return;
for (ci = 0; ci < 16; ++ci) {