[PATCH] MOD of oxygen at pO2 of 1.6 is 20ft

Dirk Hohndel dirk at hohndel.org
Sun Jul 5 11:56:29 PDT 2015


On Sun, Jul 05, 2015 at 08:26:00PM +0200, Robert C. Helling wrote:
> Hi,
> 
> > On 05 Jul 2015, at 15:09, Dirk Hohndel <dirk at hohndel.org> wrote:
> > 
> > But what I've seen in diver training and in blender training (I'm a certified trimix diver and trimix blender) is that you round to the nearest foot. Not truncate.
> 
> I guess that is the best solution: Round to the nearest meter/foot depending on units. Will later send a patch for this.

The current code claims to do that. But once you look at the code you see
that it truncates instead:

static inline depth_t gas_mod(struct gasmix *mix, pressure_t po2_limit, int roundto) {
	depth_t depth;
	depth.mm = ((po2_limit.mbar * 1000 / get_o2(mix) * 10 - 10000) / roundto) * roundto;
	return depth;
}

So all we need to do is adjust this function to add (roundto - 1) to the
enumerator before deviding by roundto, correct?

/D


More information about the subsurface mailing list