MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _read_float

Function _read_float

tools/python-3.11.9-amd64/Lib/aifc.py:188–203  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

186_HUGE_VAL = 1.79769313486231e+308 # See <limits.h>
187
188def _read_float(f): # 10 bytes
189 expon = _read_short(f) # 2 bytes
190 sign = 1
191 if expon < 0:
192 sign = -1
193 expon = expon + 0x8000
194 himant = _read_ulong(f) # 4 bytes
195 lomant = _read_ulong(f) # 4 bytes
196 if expon == himant == lomant == 0:
197 f = 0.0
198 elif expon == 0x7FFF:
199 f = _HUGE_VAL
200 else:
201 expon = expon - 16383
202 f = (himant * 0x100000000 + lomant) * pow(2.0, expon - 63)
203 return sign * f
204
205def _write_short(f, x):
206 f.write(struct.pack('>h', x))

Callers 1

_read_comm_chunkMethod · 0.85

Calls 3

_read_shortFunction · 0.85
_read_ulongFunction · 0.85
powFunction · 0.85

Tested by

no test coverage detected