(x, vdt, comp)
| 1959 | |
| 1960 | |
| 1961 | def _integer_repr(x, vdt, comp): |
| 1962 | # Reinterpret binary representation of the float as sign-magnitude: |
| 1963 | # take into account two-complement representation |
| 1964 | # See also |
| 1965 | # https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ |
| 1966 | rx = x.view(vdt) |
| 1967 | if not (rx.size == 1): |
| 1968 | rx[rx < 0] = comp - rx[rx < 0] |
| 1969 | elif rx < 0: |
| 1970 | rx = comp - rx |
| 1971 | |
| 1972 | return rx |
| 1973 | |
| 1974 | |
| 1975 | def integer_repr(x): |
no test coverage detected
searching dependent graphs…