Atlas 0.7.0
Networking protocol for the Worldforge system.
|
def encode_float(self, value): mant, exp = frexp(value) mant = long(mant *2L**20) exp = exp - 20 if mant>=0: if exp>=0: type_str = encode_pos_int(float_pos_pos_type) else: type_str = encode_pos_int(float_pos_neg_type) exp = -exp else: mant = -mant if exp>=0: type_str = encode_pos_int(float_neg_pos_type) else: type_str = encode_pos_int(float_neg_neg_type) exp = -exp return type_str + \ encode_pos_int(mant) + \ encode_pos_int(exp) More...
def encode_float(self, value): mant, exp = frexp(value) mant = long(mant *2L**20) exp = exp - 20 if mant>=0: if exp>=0: type_str = encode_pos_int(float_pos_pos_type) else: type_str = encode_pos_int(float_pos_neg_type) exp = -exp else: mant = -mant if exp>=0: type_str = encode_pos_int(float_neg_pos_type) else: type_str = encode_pos_int(float_neg_neg_type) exp = -exp return type_str + \ encode_pos_int(mant) + \ encode_pos_int(exp)
Definition at line 74 of file binary2.py.