core: return floating point from to_PSI() functions

Dive data are stored internally using integral types using
appropriately fine units (mm, mbar, mkelvin, etc.). These
are converted with functions defined in units.h for display
(m, bar, C, etc.). Usually floating points are returned by
these functions, to retain the necessary precision. There
is one exception: the to_PSI() and mbar_to_PSI() functions.

For consistency, make these functions likewise return floats.
This will be needed for the rework of the profile-axes.
The plan is to use the conversion functions to make the
axes aware of the displayed values. This in turn will be
necessary to place the ticks at sensible distances. However,
the conversions need to be precise, which is not the
case for the current to_PSI() functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-09-24 15:07:11 +02:00 committed by Dirk Hohndel
parent 322e2baa8d
commit 0e9eee0a7f
6 changed files with 9 additions and 9 deletions

View file

@ -16,7 +16,7 @@ int get_pressure_units(int mb, const char **units)
unit = translate("gettextFromC", "bar");
break;
case PSI:
pressure = mbar_to_PSI(mb);
pressure = (int)lrint(mbar_to_PSI(mb));
unit = translate("gettextFromC", "psi");
break;
}