MCPcopy Index your code
hub / github.com/numpy/numpy / integer_repr

Function integer_repr

numpy/testing/_private/utils.py:1975–1986  ·  view source on GitHub ↗

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

(x)

Source from the content-addressed store, hash-verified

1973
1974
1975def integer_repr(x):
1976 """Return the signed-magnitude interpretation of the binary representation
1977 of x."""
1978 import numpy as np
1979 if x.dtype == np.float16:
1980 return _integer_repr(x, np.int16, np.int16(-2**15))
1981 elif x.dtype == np.float32:
1982 return _integer_repr(x, np.int32, np.int32(-2**31))
1983 elif x.dtype == np.float64:
1984 return _integer_repr(x, np.int64, np.int64(-2**63))
1985 else:
1986 raise ValueError(f'Unsupported dtype {x.dtype}')
1987
1988
1989@contextlib.contextmanager

Callers 1

nulp_diffFunction · 0.85

Calls 1

_integer_reprFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…