Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Integer isclose can disagree with the tolerance equation

未關閉
#1,002 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
活躍
技術堆疊
python
領域
data

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
34
分支
34
平均合併
1 小時 11 分鐘
30 天內合併 PR
33

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

data-apis/array-api-extra 的其他 Issue

查看 data-apis/array-api-extra 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。