From ed61932579d588ba05d56b5d35738f762c58911c Mon Sep 17 00:00:00 2001 From: Robert Johansson Date: Tue, 24 Jul 2012 23:59:20 +0900 Subject: [PATCH] fixed bug in float point decoding. previously failed when exponent<0. --- mbus/mbus-protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mbus/mbus-protocol.c b/mbus/mbus-protocol.c index 02d62a1..ffbb059 100755 --- a/mbus/mbus-protocol.c +++ b/mbus/mbus-protocol.c @@ -601,7 +601,7 @@ mbus_data_float_decode(u_char *float_data) } // calculate float value - val = (float) sign * fraction * pow(2.0f, -23.0f) * (1 << exponent); + val = (float) sign * fraction * pow(2.0f, -23.0f + exponent); return val; }