Hi everyone, > On 5. Dec 2021, at 00:16, Alan Brown via subsurface > <[email protected]> wrote: > > Is this related to the warnings I am seeing in the build log, which I am > seeing following the patch? > > --snip-- > /home/alan/src/subsurface/core/profile.c: In function > ‘calculate_gas_information_new’: > /home/alan/src/subsurface/core/profile.c:1259:79: warning: conversion from > ‘double’ to ‘int’ may change value [-Wfloat-conversion] > 1259 | entry->end = mbar_to_depth(depth_to_mbar(entry->depth, dive) * (1000 > - fhe) / 1000.0, dive); > | > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ > /home/alan/src/subsurface/core/profile.c:1260:70: warning: conversion from > ‘double’ to ‘int’ may change value [-Wfloat-conversion] > 1260 | entry->ead = mbar_to_depth(depth_to_mbar(entry->depth, dive) * fn2 / > (double)N2_IN_AIR, dive); > /home/alan/src/subsurface/core/profile.c:1265:61: warning: conversion from > ‘double’ to ‘int’ may change value [-Wfloat-conversion] > 1261 | entry->eadd = mbar_to_depth(depth_to_mbar(entry->depth, dive) * > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1262 | (entry->pressures.o2 / amb_pressure * O2_DENSITY + > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1263 | entry->pressures.n2 / amb_pressure * N2_DENSITY + > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1264 | entry->pressures.he / amb_pressure * HE_DENSITY) / > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1265 | (O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000, > dive); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ > --snip--
Yes, that is related. Rather than simply adding/subtracting 10000 to convert between depth in mm and ambient pressure, these functions properly take into account the surface pressure (not exactly 1 bar) and the density of water (not exactly 1000 kg/m^3). But these functions use Subsurface internal unit types which are integer Millimeters and integer millibars. As Berthold pointed out, the letter have a quantisation that amounts to 1cm of depth and these seem to be the differences we are seeing. I pushed another version of the the pull request which does not internally quantise to integer bars which might behave better. > > For my own sanity I used qemu to build a debian 32 bit machine and did a > subsurface build from the master branch using the patch and TestProfile > failed with the same diffs. Could you please try this again with the current version. That would be great. Best Robert
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
