(x, vdt, comp)
| 1684 | |
| 1685 | |
| 1686 | def _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 | |
| 1701 | def integer_repr(x): |