From: Adrian Stratulat Date: Fri, 15 Jun 2018 13:39:15 +0000 (+0300) Subject: dtm0660: Do not apply the exponent twice on the value X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b8fcae5a128e2ca3143e05a799f80852ebd911b7;p=libsigrok.git dtm0660: Do not apply the exponent twice on the value This fixes bug #1236. --- diff --git a/src/dmm/dtm0660.c b/src/dmm/dtm0660.c index 86b6ccf7..42012399 100644 --- a/src/dmm/dtm0660.c +++ b/src/dmm/dtm0660.c @@ -254,6 +254,8 @@ static void parse_flags(const uint8_t *buf, struct dtm0660_info *info) static void handle_flags(struct sr_datafeed_analog *analog, float *floatval, int *exponent, const struct dtm0660_info *info) { + int initial_exponent = *exponent; + /* Factors */ if (info->is_nano) *exponent -= 9; @@ -265,7 +267,7 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval, *exponent += 3; if (info->is_mega) *exponent += 6; - *floatval *= powf(10, *exponent); + *floatval *= powf(10, (*exponent - initial_exponent)); /* Measurement modes */ if (info->is_volt) {