On Sun, Jul 05, 2015 at 08:26:00PM +0200, Robert C. Helling wrote:
> Hi,
>
> > On 05 Jul 2015, at 15:09, Dirk Hohndel <[email protected]> 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
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface