Route D (real fixes in embedded open-source projects) keeps producing the hard tasks: of 64 measured so far, 15 are HARD and 4 MEDIUM, mostly because Qwen exhausts its context in the larger real workspaces. This adds CANopen SRDO and ASCII timing, FreeRTOS DHCP, lwIP MQTT fragments, printf extremal exponents, Zephyr packet buffers and heatshrink (HARD), plus lwjson, RFM9x, SFUD and nanopb proto3 (MEDIUM). From batch 27 (spec-dense implementation tasks) come one HARD and one MEDIUM; that batch is winding down after 30 tasks gave 1 HARD and 3 MEDIUM. Each task comes from the commit Qwen measured, its digest matches, and it is still present at the batch branch head. Agent timeouts stay excluded: a pyserial attempt timed out on Qwen's own blocking read yet graded PASS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.5 KiB
Numeric scientific formatting near double range limits
Source and scope
- Route D, real upstream repair:
https://github.com/eyalroz/printf. - Frozen commit:
5d0c680a0f4cc876e17d31665f609f8da4707646. - Repair commit:
f83521bf96e79ae55ee41039538212a0b07db8da(its direct child). - License: MIT, verified in the frozen
LICENSEand source headers. The copyright and permission text are retained. - Split group:
eyalroz/printf; family:numeric-reliability; language: C99. - Pure software substitute: a standalone userspace program calls
snprintf_with known IEEE-754 binary64 values. No device, network, timing, or architecture-specific instruction is needed.
One upstream repair changes three functions in src/printf/printf.c: power-of-ten construction, normalized decimal components, and exponential conversion call flow. It is one coherent numerical defect; the single-repair exception applies because behavior crosses more than two functions. The source commit also adds test cases and a comment, excluded from gold. Gold contains precisely the upstream candidate-source edit; no independently invented defect is in template.
Frozen and completed files
| Template file | Origin |
|---|---|
LICENSE |
Upstream frozen, unchanged |
README.md |
Upstream frozen, unchanged |
src/printf/printf.c |
Upstream frozen, unchanged |
src/printf/printf.h |
Upstream frozen, unchanged |
docs/format-contract.md |
Added public contract, distilled from the upstream README and C99 |
Makefile |
Added smoke build only |
smoke.c |
Added normal-path smoke only |
Upstream source unique to this task is 1,602 lines (printf.c 1,401; printf.h 201). All source and headers are below 1 MiB. No upstream .git, repair test, issue text, or change log enters the template.
Behavioral evidence
The public contract is in template/docs/format-contract.md; frozen README.md documents the supported specifiers and the C standard compatibility aim. This task tests only its stated near-extremal magnitude bands and omitted or positive precision up to 10. The ordinary-value smoke is a build baseline, not a promise that this upstream snapshot implements every C99 floating case. The normative primary source is WG14 N1256, C99 TC3, §7.19.6.1 and §7.19.6.5: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf.
| Checker category | Public basis |
|---|---|
e / E mantissa width, precision, exponent marker and sign, including lower and upper magnitudes |
docs/format-contract.md:5; C99 §7.19.6.1 paragraph 8 |
g / G positive or default precision, significant digits, scientific form, trailing zeros |
docs/format-contract.md:7; C99 §7.19.6.1 paragraph 8 |
| Rounding in the documented near-extremal magnitude bands | docs/format-contract.md:9; C99 §7.19.6.1 paragraphs 8 and 13 |
Flags and snprintf_ return length |
docs/format-contract.md:11; src/printf/printf.h snprintf_ contract; C99 §7.19.6.5 |
check.py computes expected text using the container C library's snprintf in the trusted checker process, not from gold. It prepares every format and raw binary64 input before starting the candidate compiler. It passes only those inputs to a compiled observation harness. The harness prints the candidate's output and return count; it contains no answer. The checker compares captured observations after the candidate exits and never traverses candidate-writable scratch after execution. Docker container removal owns scratch cleanup. verify.py is an unmodified copy of rollout/bos_verify.py, so candidate execution and compilation run as UID 65534 in Docker.
Nearby-bit generated values are filtered by the two closed magnitude intervals stated in the public contract; the checker asserts every resulting case is in range before invoking the candidate compiler.
Samples and limitations
gold: upstream source repair.valid_alt: alternate low-end power construction and direct rounding selection based on operand magnitude.template: frozen unfixed source.noop: drops allsnprintf_output.cheat: repairs only normalized component extraction.cheat_symptom: repairs only the10^-308power.cheat_read_grader: isolation probe sample.
The existing library does not implement hexadecimal %a and deliberately switches very large %f values to exponential notation. It also has a separate ordinary-number %.0g defect (observed at 0.0012), so explicit zero precision is outside this task's contract. Difficulty has not been measured with an Agent.