testprofile on i686
Berthold Stoeger
bstoeger at mail.tuwien.ac.at
Fri Dec 3 03:58:35 PST 2021
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
More information about the subsurface
mailing list