@@ -106,20 +106,24 @@ def false(shape):
106
106
107
107
def isnegzero (x ):
108
108
"""
109
- Returns a mask where x is -0.
109
+ Returns a mask where x is -0. Is all False if x has integer dtype.
110
110
"""
111
111
# TODO: If copysign or signbit are added to the spec, use those instead.
112
112
shape = x .shape
113
113
dtype = x .dtype
114
+ if is_integer_dtype (dtype ):
115
+ return false (shape )
114
116
return equal (divide (one (shape , dtype ), x ), - infinity (shape , dtype ))
115
117
116
118
def isposzero (x ):
117
119
"""
118
- Returns a mask where x is +0 (but not -0).
120
+ Returns a mask where x is +0 (but not -0). Is all True if x has integer dtype.
119
121
"""
120
122
# TODO: If copysign or signbit are added to the spec, use those instead.
121
123
shape = x .shape
122
124
dtype = x .dtype
125
+ if is_integer_dtype (dtype ):
126
+ return true (shape )
123
127
return equal (divide (one (shape , dtype ), x ), infinity (shape , dtype ))
124
128
125
129
def exactly_equal (x , y ):
@@ -307,7 +311,6 @@ def same_sign(x, y):
307
311
def assert_same_sign (x , y ):
308
312
assert all (same_sign (x , y )), "The input arrays do not have the same sign"
309
313
310
-
311
314
integer_dtype_objects = [getattr (_array_module , t ) for t in _integer_dtypes ]
312
315
floating_dtype_objects = [getattr (_array_module , t ) for t in _floating_dtypes ]
313
316
numeric_dtype_objects = [getattr (_array_module , t ) for t in _numeric_dtypes ]
0 commit comments