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/?a=commitdiff_plain;ds=sidebyside;p=coe.git 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)