On Mon, 2014-03-17 at 13:05 -0700, Linus Torvalds wrote: > On Mon, Mar 17, 2014 at 12:25 PM, Anton Lundin <gla...@acc.umu.se> wrote: > > Fixes: 465 > > Actually, probably only on x86. > > > double ratio = (double)fhe / (1000.0 - fo2); > > + /* if we have 100% o2, ratio is nan */ > > + if (isnan(ratio)) > > + ratio = 0; > > There's no real reason to think that division by zero always returns > NaN. On some platforms or settings it might well just trap. > > In fact, it might be a good idea to have a debug mode to *make* it > trap with something like > > feenableexcept(FE_DIVBYZERO | FE_OVERFLOW); > > which could help us find these things more easily (that > feenableexcept() is a glibc extension, though, I forget how to do this > "for real"). > > So it's probably safer to just do > > ratio = fo2 === 1000 ? 0 : (double)fhe / (1000 - fo2);
The triple '=' is something I know from javascript :-) I really don't want Anton's patch. Linus hasn't submitted a better patch. I could just take both of them and merge them. The choices, the choices... I think I'll do my own patch without using the javascript extension to C :-) /D _______________________________________________ subsurface mailing list subsurface@hohndel.org http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface