Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Integer isclose can disagree with the tolerance equation

Offen
#1,002 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
data

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
33
Forks
33
Ø Merge
1 Std. 1 Min.
Gemergte PRs (30 T.)
37

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus data-apis/array-api-extra

Alle Issues in data-apis/array-api-extra

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.