[PATCH] Don't calculate with NaN when on 100% o2

Anton Lundin glance at acc.umu.se
Mon Mar 17 12:25:18 PDT 2014


Fixes: 465

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 profile.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/profile.c b/profile.c
index 2102179..20f157c 100644
--- a/profile.c
+++ b/profile.c
@@ -1131,6 +1131,9 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
 		fo2 = get_o2(&dive->cylinder[cylinderindex].gasmix);
 		fhe = get_he(&dive->cylinder[cylinderindex].gasmix);
 		double ratio = (double)fhe / (1000.0 - fo2);
+		/* if we have 100% o2, ratio is nan */
+		if (isnan(ratio))
+			ratio = 0;
 
 		if (entry->po2) {
 			/* we have an O2 partial pressure in the sample - so this
-- 
1.8.3.2



More information about the subsurface mailing list