From fd952c817e1dbbe94450d2ed798a15babb82eb7c Mon Sep 17 00:00:00 2001 From: Waldemar Porscha Date: Thu, 24 Aug 2023 10:49:55 +0200 Subject: [PATCH] soved merge problem --- src/knx/dptconvert.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/knx/dptconvert.cpp b/src/knx/dptconvert.cpp index 1e479b2..1954d2d 100644 --- a/src/knx/dptconvert.cpp +++ b/src/knx/dptconvert.cpp @@ -1749,8 +1749,8 @@ void float16ToPayload(uint8_t* payload, size_t payload_length, int index, double value *= 100.0; unsigned short exponent = 0; - if(value >= 2048) - exponent = ceil(log2(value + 1.0) - 11.0); + if(value > 2048) + exponent = ceil(log2(value) - 11.0); short mantissa = roundf(value / (1 << exponent)); // above calculation causes mantissa overflow for values of the form 2^n, where n>11