possible O2 PP display bug

Linus Torvalds torvalds at linux-foundation.org
Sat Mar 2 10:16:57 PST 2013


On Sat, Mar 2, 2013 at 10:07 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> In particular, the *first* time a pO2 of 0.009 was saved, it was saved
> as "0. 9 bar". Then, when you load that, and re-save it, what do you
> get?
>
> You don't get "0. 9 bar" again. No. You get "0. 0 bar", because the
> "9" in "0. 9" was never parsed due to the space.

The important part here is that the above argument (and the same
argument about "1.020") is true *without* the changes to subsurface.
IOW, purely with the old code. So no amount of new code can fix it,
because the old code would corrupt values all on its own, and you have
no way to tell.

The "1.200" that the old code saved could have been "1.200" from the
beginning. Or it could have been "1.020" originally.  There really is
no way to tell.

Of course, you could guess. Not based on the pattern of the digits in
the values (since the string is "1.200" in either case), but simply
based on the pattern of values. If you see odd spikes, you know the
data is bad, and then you can try to fix it up. But that isn't about
parsing the values any more, that's about data-mining and recognizing
that certain values may be corrupt.

So you could have some fancy data mining algorithm which says:

 - any mbar value that is not divisible by 10 is known to be good. If
we see a "1.101" (1101 mbar), we know it was always 1.101.

 - any mbar value of the type "x.000" migth have been "x.00?"

 - any mbar value of the type "x.yz0" might have been "x.0yz"

Using that knowledge, and looking for discontinuities, you might be
able to reconstruct things. Maybe there are other patterns too.

But quite frankly, I suspect you're better off doing a re-download.
Just check the "prefer downloaded" checkbox. If your dive computer is
fancy and supports po2 data, I'm pretty sure it has enough memory to
remember a lot of old dives.

              Linus


More information about the subsurface mailing list