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

float32 refuses a value that should saturate to an infinity

Offen Anfängerfreundlich
#19 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
75/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend

Rechercherichtung

Beginne beim compact_encoding.float32-Encoder und reproduziere den compact-encoding-test-Korpusfall namens float32-overflow, und vergleiche ihn mit dem im Issue beschriebenen struct.pack-Verhalten. Fertig bedeutet, dass das Kodieren von 4e38 keinen OverflowError mehr auslöst und die Referenzbytes 0000807f erzeugt, während der Conformance-Fall besteht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Found by running the compact-encoding-test conformance corpus against this port.

float32 refuses a value too large for binary32 instead of saturating to an infinity:

import compact_encoding as c
c.encode(c.float32, 4e38)   # OverflowError: float too large to pack with f format

The reference writes 0000807f, which reads back as infinity. That is what IEEE 754 round-to-nearest gives when a double is narrowed to binary32 and the result is out of range, so the reference's behaviour is the standard one here rather than a quirk.

The cause looks like struct.pack surfacing rather than a decision:

import struct
struct.pack('<f', 4e38)     # OverflowError: float too large to pack with f format

The corpus case is float32-overflow, citing float-overflows-to-an-infinity: "a value too large for the width becomes an infinity rather than a refusal, so float32 writes 4e38 as 0000807f and loses it. A float codec refuses no number it is given: what the width cannot hold it rounds, and what the width cannot reach becomes an infinity."

Vorherrschende Sprache
Python
Sterne
1
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

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 holepunchto/compact-encoding-python

Alle Issues in holepunchto/compact-encoding-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

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