mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
util: fix UTI_FloatNetworkToHost() with very small exponents
Fix conversion of floating point numbers from the cmdmon format with
very small exponents, as for instance could be in the smoothing report
when the smoothing process ends.
This was broken in commit 8e71a46173.
This commit is contained in:
3
util.c
3
util.c
@@ -807,9 +807,10 @@ UTI_FloatNetworkToHost(Float f)
|
||||
|
||||
x = ntohl(f.f);
|
||||
|
||||
exp = (x >> FLOAT_COEF_BITS) - FLOAT_COEF_BITS;
|
||||
exp = x >> FLOAT_COEF_BITS;
|
||||
if (exp >= 1 << (FLOAT_EXP_BITS - 1))
|
||||
exp -= 1 << FLOAT_EXP_BITS;
|
||||
exp -= FLOAT_COEF_BITS;
|
||||
|
||||
coef = x % (1U << FLOAT_COEF_BITS);
|
||||
if (coef >= 1 << (FLOAT_COEF_BITS - 1))
|
||||
|
||||
Reference in New Issue
Block a user