from utilities import int_to_float16 import struct from math import copysign, frexp, isinf, isnan, trunc NEGATIVE_INFINITY = b'\x00\xfc' POSITIVE_INFINITY = b'\x00\x7c' POSITIVE_ZERO = b'\x00\x00' NEGATIVE_ZERO = b'\x00\x80' # exp=2**5-1 and significand non-zero EXAMPLE_NAN = struct.pack('