Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 10:31 AM Linus Torvalds wrote: > > The planner does most things in floating point, so maybe that's what > goes on - doing the math in FP and then assigning to an integer. Ahhah! Caught it. I hacked up a special version of "ssrf_double_to_int()" that does range

Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 10:19 AM Linus Torvalds wrote: > > I'll play around with narrowing our types (and making them signed) and > seeing if something pops up. Nope, no luck there either. No integer overflows in sight. The planner does most things in floating point, so maybe that's what goes on

Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 10:08 AM Linus Torvalds wrote: > > It might be worth trying a few other gcc options. Things like > "-fsanitize=undefined" to find general undefined behavior (which > includes integer overflow, but also other things - but again does > *not* include the well-defined unsigned

Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 10:00 AM Linus Torvalds wrote: > > So using -ftrapv actually works, but may not be practical. But for > debugging this particular issue, I'll just start with an empty dive > log and try your planner thing. Hmm. I can do that, but then I don't see any issue. And in fact,

Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 9:51 AM Linus Torvalds wrote: > > It might be worth trying to just build subsurface with "-ftrapv". Yeah, that just SIGABRT's immediately for me just from loading my dives. Apparently I have a dive with ndl=71582788:15 in my dive log, because that's how we print a

Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 9:31 AM Linus Torvalds wrote: > > Now, it is possible that while you're doing some intermediate > calculations, you might end up having temporary values that are bigger > than int32_t (say, because you're multiplying millimeters by millibars > and haven't reduced the range

Re: Large negative pressures

2019-08-07 Thread Linus Torvalds
On Wed, Aug 7, 2019 at 6:42 AM Robert Helling wrote: > > The planner tries computes the consumed gas for the dives it plans. It > computes it in terms of litres of gas. Then, in the end, using the assumed > cylinder size this is converted into a pressure drop. > > As you know, internally, all

Large negative pressures

2019-08-07 Thread Robert Helling
Hi, here is a problem that came up in https://github.com/Subsurface-divelog/subsurface/issues/2212 that I would like your opinion on how to address it: The planner tries computes the consumed gas for the dives it plans. It computes it in terms of litres of gas. Then, in the end, using the