Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Integer isclose can disagree with the tolerance equation

Aperta
#1,002 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
33
Fork
33
Merge medio
1h 1m
PR unite (30g)
37

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di data-apis/array-api-extra

Tutte le issue di data-apis/array-api-extra

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.