Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Integer isclose can disagree with the tolerance equation

Đang mở
#1,002 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

Reproduce the two examples with array_api_extra.isclose and array_api_strict, then inspect the array-agnostic path and the Notes describing the tolerance equation. Clarify the intended integer semantics, including behavior for large int64/uint64 values; done means the chosen behavior is documented and the reported disagreements have corresponding coverage.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

On current main, the array-agnostic path gives two results that disagree with the displayed tolerance equation when using array_api_strict:

import array_api_extra as xpx
import array_api_strict as xp

def check(a, b, atol, rtol):
    return bool(xpx.isclose(xp.asarray(a, dtype=xp.int8),
                            xp.asarray(b, dtype=xp.int8),
                            atol=atol, rtol=rtol))

print(check(0, 100, 30, 1.0))  # False; 100 <= 30 + 100
print(check(15, 10, 0, 0.4))   # True; 5 > 0.4 * 10

The first result appears to come from integer overflow in the tolerance sum; the second from truncating 1/rtol to an integer. The Notes currently introduce the tolerance equation for floating-point values. For integer inputs, should the agnostic path compare exact integer differences against the supplied scalar tolerances, or follow NumPy-like floating evaluation (including rounding large int64/uint64 values)? That choice affects a fix that also preserves large-integer comparisons.

Ngôn ngữ chính
Python
Star
33
Fork
33
Merge trung bình
1 giờ 16 phút
Pull request đã merge (30 ngày)
32

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của data-apis/array-api-extra

Tất cả issue của data-apis/array-api-extra

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.