Skip to content

Commit 3d05447

Browse files
committed
Use ph for pos/neg zero utils
1 parent 2cebe8f commit 3d05447

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

array_api_tests/test_special_cases.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,21 @@
1010

1111
from . import dtype_helpers as dh
1212
from . import hypothesis_helpers as hh
13+
from . import pytest_helpers as ph
1314
from . import shape_helpers as sh
1415
from . import xps
1516
from ._array_module import mod as xp
1617
from .stubs import category_to_funcs
1718

1819

19-
def is_pos_zero(n: float) -> bool:
20-
return n == 0 and math.copysign(1, n) == 1
21-
22-
23-
def is_neg_zero(n: float) -> bool:
24-
return n == 0 and math.copysign(1, n) == -1
25-
26-
2720
def make_eq(v: float) -> Callable[[float], bool]:
2821
if math.isnan(v):
2922
return math.isnan
3023
if v == 0:
31-
if is_pos_zero(v):
32-
return is_pos_zero
24+
if ph.is_pos_zero(v):
25+
return ph.is_pos_zero
3326
else:
34-
return is_neg_zero
27+
return ph.is_neg_zero
3528

3629
def eq(i: float) -> bool:
3730
return i == v
@@ -230,8 +223,8 @@ def parse_binary_docstring(docstring: str) -> Dict[Callable, Result]:
230223
cond = make_cond(*values)
231224
if (
232225
"atan2" in docstring
233-
and is_pos_zero(values[0])
234-
and is_neg_zero(values[1])
226+
and ph.is_pos_zero(values[0])
227+
and ph.is_neg_zero(values[1])
235228
):
236229
breakpoint()
237230
try:

0 commit comments

Comments
 (0)