[PATCH 1/6] Fixed rounding error with ascent rates.
John Van Ostrand
john at vanostrand.com
Mon Jan 11 07:22:53 PST 2016
---
src/cochran_emc_parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cochran_emc_parser.c b/src/cochran_emc_parser.c
index 635f050..5d430f4 100644
--- a/src/cochran_emc_parser.c
+++ b/src/cochran_emc_parser.c
@@ -246,7 +246,7 @@ cochran_emc_parser_samples_foreach (dc_parser_t *abstract,
// Ascent rate is logged in the 0th sample, temp in the 1st, repeat.
if (time % 2 == 0) {
// Ascent rate
- ascent_rate = (s[1] & 0x7f) / 4 * (s[1] & 0x80 ? 1 : -1);
+ ascent_rate = (float) (s[1] & 0x7f) / 4 * (s[1] & 0x80 ? 1 : -1);
sample.ascent_rate = ascent_rate * FEET;
if (callback) callback (DC_SAMPLE_ASCENT_RATE, sample, userdata);
} else {
--
2.4.3
More information about the devel
mailing list