Use higher precision for linspace with double (#3029)

This commit is contained in:
Awni Hannun
2026-01-21 06:20:50 -08:00
committed by GitHub
parent 9a277a277a
commit 1d56dfdf59
3 changed files with 17 additions and 4 deletions
+9
View File
@@ -292,6 +292,15 @@ class TestDouble(mlx_tests.MLXTestCase):
b = np.array(a)
self.assertTrue(np.array_equal(a, b))
a = mx.array([1.0, 2.0], mx.float64)
b = a.tolist()
self.assertEqual(b, [1.0, 2.0])
def test_linspace(self):
with mx.stream(mx.cpu):
vals = mx.linspace(0, math.pi, 2, mx.float64)
self.assertEqual(vals.tolist()[1], math.pi)
if __name__ == "__main__":
mlx_tests.MLXTestRunner()