diff options
author | Jan Schubert <Jan.Schubert@GMX.li> | 2013-01-24 23:09:53 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-24 15:00:52 -0800 |
commit | 50d0391dfbf8f63894abeb288dd4467f06f31b4c (patch) | |
tree | a142c06cfddf081aaa806127a3fc26d1fe593eb6 /dive.h | |
parent | 67d8891af5ff98870f519a4282918ad2ebd4b3ff (diff) | |
download | subsurface-50d0391dfbf8f63894abeb288dd4467f06f31b4c.tar.gz |
Centralization for Kelvin and Standardization to milliKelvin
This centralizes all occurrences of Kelvin to dive.h and standardizes all
usages to milliKelvin.
[Dirk Hohndel: renamed the constant plus minor white space cleanup]
Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -11,13 +11,14 @@ #include <libxml/tree.h> #include <openssl/sha.h> -#define O2_IN_AIR 209 // permille -#define N2_IN_AIR 781 -#define O2_DENSITY 1429 // mg/Liter -#define N2_DENSITY 1251 -#define HE_DENSITY 179 -#define SURFACE_PRESSURE 1013 // mbar +#define O2_IN_AIR 209 // permille +#define N2_IN_AIR 781 +#define O2_DENSITY 1429 // mg/Liter +#define N2_DENSITY 1251 +#define HE_DENSITY 179 +#define SURFACE_PRESSURE 1013 // mbar #define SURFACE_PRESSURE_STRING "1013" +#define ZERO_C_IN_MKELVIN 273150 // mKelvin /* @@ -161,7 +162,7 @@ static inline int to_feet(depth_t depth) static inline double mkelvin_to_C(int mkelvin) { - return (mkelvin - 273150) / 1000.0; + return (mkelvin - ZERO_C_IN_MKELVIN) / 1000.0; } static inline double mkelvin_to_F(int mkelvin) @@ -171,12 +172,12 @@ static inline double mkelvin_to_F(int mkelvin) static inline unsigned long F_to_mkelvin(double f) { - return (f-32) * 1000 / 1.8 + 273150.5; + return (f-32) * 1000 / 1.8 + ZERO_C_IN_MKELVIN + 0.5; } static inline unsigned long C_to_mkelvin(double c) { - return c * 1000 + 273150.5; + return c * 1000 + ZERO_C_IN_MKELVIN + 0.5; } static inline double psi_to_bar(double psi) |