Skip to content

Commit 5a126fd

Browse files
Added a test to ensure that linspace handles extreme FP values well
1 parent 7849858 commit 5a126fd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,21 @@ def test_linspace_fp():
11681168
assert X.strides == (1,)
11691169

11701170

1171+
@pytest.mark.parametrize("dtype", ["f2", "f4", "f8"])
1172+
def test_linspace_fp_max(dtype):
1173+
q = get_queue_or_skip()
1174+
skip_if_dtype_not_supported(dtype, q)
1175+
n = 16
1176+
dt = dpt.dtype(dtype)
1177+
max_ = dpt.finfo(dt).max
1178+
X = dpt.linspace(max_, max_, endpoint=True, num=n, dtype=dt, sycl_queue=q)
1179+
assert X.shape == (n,)
1180+
assert X.strides == (1,)
1181+
assert np.allclose(
1182+
dpt.asnumpy(X), np.linspace(max_, max_, endpoint=True, num=n, dtype=dt)
1183+
)
1184+
1185+
11711186
@pytest.mark.parametrize(
11721187
"dt",
11731188
_all_dtypes,

0 commit comments

Comments
 (0)