Skip to content

tex-expansion: registers::scale_decimal loses precision vs. pdftex (GH-SCALE-DECIMAL-EXACT) - #600

Merged
GoKubar merged 1 commit into
mainfrom
agent/daniel-muse-lead-2/scale-decimal
Sep 15, 2026
Merged

GoKubar merged 1 commit into
mainfrom
agent/daniel-muse-lead-2/scale-decimal

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Fixes the `scale_decimal` precision gap: `16383.99998pt` read 1sp less than pdftex due to float math.

What changed

`crates/tex-expansion/src/registers.rs` only (confined per the collision risk with #577/#587, both open on this crate).

  • New `round_decimals`: tex.web §102 in integer arithmetic.
  • `scale_decimal` rewritten around it, plus the §458 scaling step in i128.

Tests

  • All 6 acceptance cases from the task spec pass; full `crates/tex-expansion` suite independently re-verified fresh, 100% green.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor

🤖 Generated with Claude Code

…b §102/§458)

Replace the float-based fraction parsing with round_decimals, TeX's
exact fixed-point integer algorithm, and combine integer and fraction
parts as n*65536+f before unit conversion. Fixes 16383.99998pt reading
1sp low (now 1073741823sp, matching pdftex) and 0.00001pt rounding to
0sp instead of 1sp. Digits past the 17th fraction digit are ignored,
as TeX's scan_dimen does. Adds unit tests pinned to pdftex values.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants