Re: Subsurface ignores a temp of 0˚C

Linus Torvalds torvalds at linux-foundation.org
Wed Jan 23 12:32:34 PST 2013


On Wed, Jan 23, 2013 at 12:09 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
>> - Negative temperature values doesn't seem to be displayed in the profile
>
> Mind sending me your XML file, I'll take a look..

Heh. They are displayed. But the rounding is wrong for them, so -1 is
rounded to 0.

We use "(int)(val+0.5)" which works fine for positive values, but for
negative values integer truncation truncates towards zero. So -1+0.5
is -0.5, and then truncates to 0.

This should fix things, and prints things out more nicely anyway if
you happen to have fractional degrees.

                    Linus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 1234 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130123/485b730f/attachment.obj>


More information about the subsurface mailing list