lib/bcd: to_bcd and from_bcd silently lose digits past 2^53 although documented as "any width"
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
Start with lib/bcd.eigs at the cited to_bcd and from_bcd ranges, then read the existing BCD tests and the numeric representation limits they rely on. Run the reproductions in the issue and check the test suite's conventions for errors. Done means unsupported inputs or results raise rather than round, the largest supported width round-trips exactly, the next width raises, and docs/STDLIB.md:406 states the limit.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Found by the read-only lib/ audit (hq RULES.md, audit area 4). Reproduced on main at d3ec498.
What's wrong
docs/STDLIB.md:406 and lib/bcd.eigs say the codec works at "any width", and the module's own rule is that bad input "should fail loudly, not decode to a plausible number". But a 14-digit value packs to 56 bits, past the 2^53 range a double holds exactly. to_bcd (lib/bcd.eigs:35-48) rounds the packed result, and from_bcd (lib/bcd.eigs:19-33) decodes the rounded value to a different number with no error.
Repro
load_file of "lib/bcd.eigs"
print of (from_bcd of (to_bcd of 9999999999999))
print of (from_bcd of (to_bcd of 99999999999999))
print of (to_bcd of 99999999999999)
Actual:
9999999999999
99999999999998
4.323455642275676e+16
Expected: the second line is 99999999999999, and the third is the exact value 0x99999999999999 (43234556422756761). Where the result can't be held exactly, both functions should raise instead of rounding.
Note: Phase 2 (#1776, exact int64) may make widths up to 15 digits exact. The raise is still needed beyond the integer range, and the "any width" claim needs a stated limit either way.
Done when
-
to_bcdandfrom_bcdraise when the input or the result is outside the exactly representable integer range, and docs/STDLIB.md:406 states that limit instead of "any width". - A test round-trips the largest supported width exactly and checks that one digit more raises; the round-trip check of
99999999999999fails ond3ec498(or is replaced by the raise check if 14 digits ends up beyond the limit).
— Duet (orchestrator)
- Lenguaje dominante
- C
- Estrellas
- 3
- Forks
- 7
- Merge medio
- 6 h 32 min
- PR fusionados (30 d)
- 285
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de InauguralSystems/EigenScript
-
good first issue needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
InauguralSystems/EigenScript#2347 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
InauguralSystems/EigenScript#2335 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:embed kind:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
InauguralSystems/EigenScript#2311 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:gates kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
InauguralSystems/EigenScript#2305 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:ci bug found-by:duet-audit
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
InauguralSystems/EigenScript#2283 ·
Los mantenedores suelen responder en 1 día
Todos los issues de InauguralSystems/EigenScript
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FujiNetWIFI/fujinet-config#379 ·
Los mantenedores suelen responder en 1 día
-
Ship /Local/Applications, the Local domain's Applications folderPosiblemente ocupada @pkgdemon la tomó hoy. Abiertoarea:base enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
nextbsd/nextbsd-userland#612 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
zephyrproject-rtos/zephyr#125543 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
colbymchenry/codegraph#3277 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100