From cef5442b93483149e132b6e1b1fdd787c333d387 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Mon, 27 Jun 2022 14:58:37 +0200 Subject: [PATCH] bin: Fixed float decoding bug. --- coe/bin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coe/bin.py b/coe/bin.py index 08e521e..e9efc80 100644 --- a/coe/bin.py +++ b/coe/bin.py @@ -302,15 +302,15 @@ class decoder(object): exp = self.loadint(buf) if mnt == 0: if exp == 0: - return 0.0 + ret = 0.0 elif exp == 1: - return -0.0 + ret = -0.0 elif exp == 2: - return float("inf") + ret = float("inf") elif exp == 3: - return -float("inf") + ret = -float("inf") else: - return float("nan") + ret = float("nan") else: ret = math.ldexp(mnt, exp - (mnt.bit_length() - 1)) return self.addref(ret) -- 2.11.0