MCPcopy Create free account
hub / github.com/Firepal/stammer / as_array

Function as_array

fraction_bits.py:14–19  ·  view source on GitHub ↗
(num)

Source from the content-addressed store, hash-verified

12
13 # Special-case zero and subnormals, since num.hex() can return '0x0.0p+0'
14 # or a non-'0x1.' form, which would break the split below.
15 if num == 0.0:
16 return '0' * 64
17
18 parts = num.hex().split('0x1.')[-1].split('p')
19 hex_mantissa = '1' + parts[0]
20 unshifted = bin(int(hex_mantissa, 16))[2:]
21 place = int(parts[1])
22

Callers

nothing calls this directly

Calls 1

get_string_from_doubleFunction · 0.85

Tested by

no test coverage detected