Dolda2000 GitWeb
/
coe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e39561b
)
bin: Fixed float decoding bug.
master
author
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 27 Jun 2022 12:58:37 +0000
(14:58 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 27 Jun 2022 12:58:37 +0000
(14:58 +0200)
coe/bin.py
patch
|
blob
|
blame
|
history
diff --git
a/coe/bin.py
b/coe/bin.py
index
08e521e
..
e9efc80
100644
(file)
--- 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:
exp = self.loadint(buf)
if mnt == 0:
if exp == 0:
- ret
urn
0.0
+ ret
=
0.0
elif exp == 1:
elif exp == 1:
- ret
urn
-0.0
+ ret
=
-0.0
elif exp == 2:
elif exp == 2:
- ret
urn
float("inf")
+ ret
=
float("inf")
elif exp == 3:
elif exp == 3:
- ret
urn
-float("inf")
+ ret
=
-float("inf")
else:
else:
- ret
urn
float("nan")
+ ret
=
float("nan")
else:
ret = math.ldexp(mnt, exp - (mnt.bit_length() - 1))
return self.addref(ret)
else:
ret = math.ldexp(mnt, exp - (mnt.bit_length() - 1))
return self.addref(ret)