Strange unit conversions
jukka.lind at kolumbus.fi
jukka.lind at kolumbus.fi
Wed Feb 20 00:54:30 PST 2013
Pressure unit conversions in dive.h seem strange to me.
What is the meaning of "0.5" in psi_to_mba and int to_PS ? If they're there to minimize rounding error when moving from integer to real, shouldn't they be before the multiplying ?
The error at normal tank pressures is minimal and at 1 bar just about 3 %, but anyhow.
191 static inline unsigned long psi_to_mbar(double psi)
192 {
193 return psi_to_bar(psi)*1000 + 0.5;
194 }
195
196 static inline int to_PSI(pressure_t pressure)
197 {
198 return pressure.mbar * 0.0145037738 + 0.5;
199 }
Sorry I haven't the "development environment" set up yet.
Signed-off-by: Jukka Lind <lino at iki.fi>
More information about the subsurface
mailing list