Skip to content

Commit

Permalink
BUG: Type conversion for integer overflow check
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Dec 23, 2022
1 parent dbfdcbd commit f7a1439
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions numpy/lib/arraysetops.py
Expand Up @@ -656,8 +656,8 @@ def in1d(ar1, ar2, assume_unique=False, invert=False, *, kind=None):
# 2. Check overflows for (ar2 - ar2_min); dtype=ar2.dtype
range_safe_from_overflow = ar2_range < np.iinfo(ar2.dtype).max
# 3. Check overflows for (ar1 - ar2_min); dtype=ar1.dtype
range_safe_from_overflow &= ar1_max - ar2_min < np.iinfo(ar1.dtype).max
range_safe_from_overflow &= ar1_min - ar2_min > np.iinfo(ar1.dtype).min
range_safe_from_overflow &= int(ar1_max) - int(ar2_min) < np.iinfo(ar1.dtype).max
range_safe_from_overflow &= int(ar1_min) - int(ar2_min) > np.iinfo(ar1.dtype).min

# Optimal performance is for approximately
# log10(size) > (log10(range) - 2.27) / 0.927.
Expand Down

0 comments on commit f7a1439

Please sign in to comment.