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

Function _integer_repr

numpy/testing/_private/utils.py:1686–1698  ·  view source on GitHub ↗
(x, vdt, comp)

Source from the content-addressed store, hash-verified

1684
1685
1686def _integer_repr(x, vdt, comp):
1687 # Reinterpret binary representation of the float as sign-magnitude:
1688 # take into account two-complement representation
1689 # See also
1690 # https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
1691 rx = x.view(vdt)
1692 if not (rx.size == 1):
1693 rx[rx < 0] = comp - rx[rx < 0]
1694 else:
1695 if rx < 0:
1696 rx = comp - rx
1697
1698 return rx
1699
1700
1701def integer_repr(x):

Callers 1

integer_reprFunction · 0.85

Calls 1

viewMethod · 0.45

Tested by

no test coverage detected