|
1 | 1 | from ._array_module import (isnan, all, any, equal, not_equal, logical_and,
|
2 |
| - logical_or, isfinite, greater, less, less_equal, |
| 2 | + logical_or, isfinite, greater, less_equal, |
3 | 3 | zeros, ones, full, bool, int8, int16, int32,
|
4 | 4 | int64, uint8, uint16, uint32, uint64, float32,
|
5 | 5 | float64, nan, inf, pi, remainder, divide, isinf,
|
@@ -164,6 +164,16 @@ def notequal(x, y):
|
164 | 164 |
|
165 | 165 | return not_equal(x, y)
|
166 | 166 |
|
| 167 | +def less(x, y): |
| 168 | + """ |
| 169 | + Same as less(x, y) except it allows comparing uint64 with signed int dtypes |
| 170 | + """ |
| 171 | + if x.dtype == uint64 and dh.dtype_signed[y.dtype]: |
| 172 | + return xp.where(y < 0, xp.asarray(False), xp.less(x, xp.astype(y, uint64))) |
| 173 | + if y.dtype == uint64 and dh.dtype_signed[x.dtype]: |
| 174 | + return xp.where(x < 0, xp.asarray(True), xp.less(xp.astype(x, uint64), y)) |
| 175 | + return xp.less(x, y) |
| 176 | + |
167 | 177 | def assert_exactly_equal(x, y, msg_extra=None):
|
168 | 178 | """
|
169 | 179 | Test that the arrays x and y are exactly equal.
|
|
0 commit comments