MCPcopy Create free account
hub / github.com/numpy/numpy / test_addition_negative_zero

Function test_addition_negative_zero

numpy/core/tests/test_ufunc.py:2816–2829  ·  view source on GitHub ↗
(dtype)

Source from the content-addressed store, hash-verified

2814
2815@pytest.mark.parametrize("dtype", np.typecodes["AllFloat"])
2816def test_addition_negative_zero(dtype):
2817 dtype = np.dtype(dtype)
2818 if dtype.kind == "c":
2819 neg_zero = dtype.type(complex(-0.0, -0.0))
2820 else:
2821 neg_zero = dtype.type(-0.0)
2822
2823 arr = np.array(neg_zero)
2824 arr2 = np.array(neg_zero)
2825
2826 assert _check_neg_zero(arr + arr2)
2827 # In-place ops may end up on a different path (reduce path) see gh-21211
2828 arr += arr2
2829 assert _check_neg_zero(arr)
2830
2831
2832@pytest.mark.parametrize("dtype", np.typecodes["AllFloat"])

Callers

nothing calls this directly

Calls 2

_check_neg_zeroFunction · 0.85
dtypeMethod · 0.45

Tested by

no test coverage detected