From 638e7fb28fa48adfb4d9ecba132bbc26990b4056 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 11 Jan 2017 09:22:41 -0800 Subject: Add cylinder equipment tooltips with gas volume This adds tooltips for the equipment tab for each cylinder, showing the amount of gas used. When you mouse over the size and working pressure fields, the tooltip will show the amount of gas used (along with start and end gas volumes). And when you mouse over the start and end pressures, it will show the start and end gas volumes, and the Z factor used. I started doing this because of the gas volume questions in the last day or two (and a few from a few weeks ago). When even Robert Helling starts wondering about the effects of compressibility on the SAC calculation, our numbers are clearly too opaque. With these tooltips, at least you can see what went into the used gas calculations, instead of having to add debugging options to print out Z factors. [ This patch also adds a "rint()" to get the rounding right in the gas_volume() function. Although rounding to the nearst milliliter really doesn't matter, it's the right thing to do after doing FP calculations ;^] Signed-off-by: Linus Torvalds --- core/dive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/dive.c b/core/dive.c index c1d5b7324..75f48e8a9 100644 --- a/core/dive.c +++ b/core/dive.c @@ -872,7 +872,7 @@ int gas_volume(cylinder_t *cyl, pressure_t p) { double bar = p.mbar / 1000.0; double z_factor = gas_compressibility_factor(&cyl->gasmix, bar); - return cyl->type.size.mliter * bar_to_atm(bar) / z_factor; + return rint(cyl->type.size.mliter * bar_to_atm(bar) / z_factor); } /* -- cgit v1.2.3-70-g09d2