MCPcopy Create free account
hub / github.com/numpy/numpy / integer_repr

Function integer_repr

numpy/testing/_private/utils.py:1701–1712  ·  view source on GitHub ↗

Return the signed-magnitude interpretation of the binary representation of x.

(x)

Source from the content-addressed store, hash-verified

1699
1700
1701def integer_repr(x):
1702 """Return the signed-magnitude interpretation of the binary representation
1703 of x."""
1704 import numpy as np
1705 if x.dtype == np.float16:
1706 return _integer_repr(x, np.int16, np.int16(-2**15))
1707 elif x.dtype == np.float32:
1708 return _integer_repr(x, np.int32, np.int32(-2**31))
1709 elif x.dtype == np.float64:
1710 return _integer_repr(x, np.int64, np.int64(-2**63))
1711 else:
1712 raise ValueError(f'Unsupported dtype {x.dtype}')
1713
1714
1715@contextlib.contextmanager

Callers 1

nulp_diffFunction · 0.85

Calls 1

_integer_reprFunction · 0.85

Tested by

no test coverage detected