Don't bother with "correct" units for the pressure_time calculation

Linus Torvalds torvalds at linux-foundation.org
Sun Jan 6 23:33:42 PST 2013


I fixed the pressure-time calculations to use "proper" units, but
thinking about it some more, it turns out that units don't really
matter. As long as we use the *same* unit for calculating the
integral, and then re-calculating the step-wise entries, the units
will cancel out.

So we can simplify the "pressure_time()" function a bit, and use
whatever units are most natural for our internal representation. So
instead of using atm, use "mbar".

Now, since the units don't matter, this patch doesn't really make much
of a difference conceptually. Sure, it's a slightly simpler function,
but maybe using more "natural" units for it would be worth it. But it
turns out that using milli-bar and seconds has an advantage: we could
do all the pressure_time integral using 32-bit integers, and we'd
still be able to represent values that would be equivalent to staying
at 24 bar for a whole day.

This patch doesn't actually change the code to use integers, but with
this unit choice, we at least have that possibility.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 1078 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130106/0f453948/attachment.obj>


More information about the subsurface mailing list