mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-06 16:51:24 +08:00
Remainder negative numerator bug fixed (#641)
Co-authored-by: Angelos Katharopoulos <a_katharopoulos@apple.com>
This commit is contained in:

committed by
GitHub

parent
b57bd0488d
commit
b670485185
@@ -275,6 +275,20 @@ class TestOps(mlx_tests.MLXTestCase):
|
||||
self.assertEqual(z.dtype, dt)
|
||||
self.assertEqual(z.item(), 1)
|
||||
|
||||
z = -1 % x
|
||||
self.assertEqual(z.dtype, dt)
|
||||
self.assertEqual(z.item(), 1)
|
||||
|
||||
z = -1 % -x
|
||||
self.assertEqual(z.dtype, dt)
|
||||
self.assertEqual(z.item(), -1)
|
||||
|
||||
x = mx.arange(10).astype(dt) - 5
|
||||
y = x % 5
|
||||
z = x % -5
|
||||
self.assertEqual(y.tolist(), [0, 1, 2, 3, 4, 0, 1, 2, 3, 4])
|
||||
self.assertEqual(z.tolist(), [0, -4, -3, -2, -1, 0, -4, -3, -2, -1])
|
||||
|
||||
def test_comparisons(self):
|
||||
a = mx.array([0.0, 1.0, 5.0])
|
||||
b = mx.array([-1.0, 2.0, 5.0])
|
||||
|
Reference in New Issue
Block a user