From: Fredrik Tolf Date: Mon, 27 Jun 2022 12:58:37 +0000 (+0200) Subject: bin: Fixed float decoding bug. X-Git-Url: http://www.dolda2000.com/gitweb/?p=coe.git;a=commitdiff_plain;h=cef5442b93483149e132b6e1b1fdd787c333d387 bin: Fixed float decoding bug. --- 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)