+ @staticmethod
+ def writefloat(dst, x):
+ if x == 0.0:
+ mnt, exp = (0, 0)
+ elif math.isinf(x):
+ if x > 0:
+ mnt, exp = (0, 2)
+ else:
+ mnt, exp = (0, 3)
+ elif math.isnan(x):
+ mnt, exp = (0, 4)
+ else:
+ mnt, exp = math.frexp(x)
+ mnt *= 2
+ exp -= 1
+ while mnt != int(mnt):
+ mnt *= 2
+ mnt = int(mnt)
+ buf = bytearray()
+ buf.extend(encoder.encint(mnt))
+ buf.extend(encoder.encint(exp))
+ dst.write(encoder.encint(len(buf)))
+ dst.write(buf)
+