soved merge problem

This commit is contained in:
Waldemar Porscha 2023-08-24 10:49:55 +02:00
parent a5c79214e3
commit fd952c817e

View File

@ -1749,8 +1749,8 @@ void float16ToPayload(uint8_t* payload, size_t payload_length, int index, double
value *= 100.0; value *= 100.0;
unsigned short exponent = 0; unsigned short exponent = 0;
if(value >= 2048) if(value > 2048)
exponent = ceil(log2(value + 1.0) - 11.0); exponent = ceil(log2(value) - 11.0);
short mantissa = roundf(value / (1 << exponent)); short mantissa = roundf(value / (1 << exponent));
// above calculation causes mantissa overflow for values of the form 2^n, where n>11 // above calculation causes mantissa overflow for values of the form 2^n, where n>11