Planner-Bug-Candidate: Stop-Times

Linus Torvalds torvalds at linux-foundation.org
Sat Jun 4 09:25:51 PDT 2022


On Sat, Jun 4, 2022 at 6:24 AM Robert Helling via subsurface
<subsurface at subsurface-divelog.org> wrote:
>
> I created a pull request that fixes this problem: https://github.com/subsurface/subsurface/pull/3462

Does it really make sense to show negative stop-times at all?

Wouldn't it make more sense to just make analyzeVariations() return 0
instead of negative values?

And yes, the reason 'FRACTION()' does that explicit unsigned thing is
because negative values don't have sane well-defined behavior wrt
division and modulus in C (ie the division rounding towards zero will
then cause a negative fractional value).

Your SIGNED_FRACTION() avoids that problem, but it does seem a bit
questionable to ever show negative values in things that want
fractions (which are generally physical units: time, depth, things
like that).

              Linus


More information about the subsurface mailing list