summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-19 11:13:55 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-19 11:36:54 -0500
commit6ed189f32c466f99167ab6657264a45da4b56e8e (patch)
tree659c97401ad49daf996fb04b397897bb2669a3f3 /dive.c
parent150676ce3df0f60bd99204886c3a4e458253c093 (diff)
downloadsubsurface-6ed189f32c466f99167ab6657264a45da4b56e8e.tar.gz
Planner: bring sanity to the SAC rate handling
The old implementation was... let's call it creative. This tries to actually get things right instead of using magic. Don't pretend that double values are ints. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/dive.c b/dive.c
index 38599b104..22cf3ad46 100644
--- a/dive.c
+++ b/dive.c
@@ -188,15 +188,12 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
return vol;
}
-int units_to_sac(int volume)
+int units_to_sac(double volume)
{
if(get_units()->volume == CUFT)
- if (volume < 10)
- return cuft_to_l(volume) * 100;
- else
- return cuft_to_l(volume) * 10;
+ return rint(cuft_to_l(volume) * 1000.0);
else
- return volume * 1000;
+ return rint(volume * 1000);
}
unsigned int units_to_depth(double depth)