Python导出Half Precison浮点数

>>> import numpy as np

>>> bin(np.float16(117.0).view('H'))[2:].zfill(16)

Output : '0101011101010000'

或者

data = numpy.float16(2.3).tostring()

https://stackoverflow.com/questions/33451800/decimal-to-binary-half-precision-ieee-754-in-python

你可能感兴趣的:(Python导出Half Precison浮点数)