Decimal values rounded on save

Linus Torvalds torvalds at linux-foundation.org
Mon Sep 3 10:00:43 PDT 2012


On Mon, Sep 3, 2012 at 1:48 AM, Ivan Habunek <ivan.habunek at gmail.com> wrote:
>
> Tested on windows xp and 7, using subsurface 1.2 and the latest build
> from https://github.com/neolit123/subsurface_win32 (dated 31.08). I
> suppose this might be a windows issue since nobody has reported it so
> far.
>
> To reproduce:
> 1. Download divelog from http://pastebin.com/hvP8Kx90
> 2. Open divelog in subsurface
> 3. Hit File > Save
>
> Expected:
> Divelog same as before
>
> Actual:
> Divelog changed and looks like this:

Interesting. Trying it on Linux, I did see *one* rounding issue (depth
of "0.019 m" was somehow saved as "0.018 m" - I'll look into it), and
it also saving it removed the cylinder data as irrelevant (it's air).
But on windows, the floating point is all saved rounded to integers.
That's just horribly wrong.

It's also really strange. We use "show_milli()" to show depth in mm
*exactly*, so there isn't even any floating point involved. I think we
must be screwing up at loading time.

When you load the original file under Windows, does the depth plot
look "jagged" (ie does it look like the depth is already rounded to
meters at that point?). Or do you see a nice plot with (for example)
the shallow point at 45 minutes into the dive being shown as "5.2 m"
deep?

This is clearly triggered by some windows difference, I'm just trying
to see if it's at load-time or at save-time that the rounding
happens..

         Linus


More information about the subsurface mailing list