On Freitag, 3. Dezember 2021 12:49:48 CET Berthold Stoeger via subsurface wrote: > Hi Robert, > > On Donnerstag, 2. Dezember 2021 08:38:25 CET Robert Helling via subsurface > > wrote: > > fn2 = (int)(1000.0 * entry->pressures.n2 / > > amb_pressure); > > This looks ill-defined. You probably want lrint(...) or (int)(round(...)) or > (int)(ceil(...)) or (int)(floor(...)) for reproducible behavior.
Indeed, by rounding one down, I get the "alternative" value. And of course, ceil() and floor() would exhibit the same instability depending on whether you are eps above or below the integer. So I reckon you should use round(...) or lrint(...). Berthold _______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface