Skip to content

feat: support integer long division - #326

Open
Happypig375 wants to merge 4 commits into
masterfrom
issue-302-longdiv
Open

feat: support integer long division#326
Happypig375 wants to merge 4 commits into
masterfrom
issue-302-longdiv

Conversation

@Happypig375

@Happypig375 Happypig375 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add semantic LongDivision and step records for bounded nonnegative integer division
  • parse canonical \longdiv{numerator}{denominator} in CTAN argument order with deterministic source-positioned errors
  • render the header through a private display that sizes the right parenthesis with existing math-table logic, positions it independently with a half-rule overlap, and draws one bar across the delimiter and dividend
  • keep right-aligned place-value subtraction work and exactly one final remainder
  • serialize and clone the semantic atom, enforce a 28-digit limit, and reject zero denominators or malformed operands

Validation

  • LongDivisionTests: 27 passed
  • dedicated backend, scaling, and pixel-connectivity tests: 16 passed
  • Skia and Avalonia MathDisplay and MathInline golden runs: 97/97 per selector
  • the official CTAN longdiv.tex was compiled with Tectonic 0.17.0 and rasterized at 1200 DPI; its overbar and raised parenthesis form one connected pixel component
  • all 10 final display/inline long-division goldens were visually inspected and verified with a 4-neighbor component check; Text and Script styles also verify the junction in both backends
  • changed-file formatting, git diff checks, and a scoped secret-pattern scan passed

Review

  • independent Codex review found that the first candidate lacked a direct junction regression; the new Skia/Avalonia Text/Script pixel test was added
  • follow-up review caught a transient equality/hash mismatch in the private header atom; those overrides were removed
  • final independent re-review approved the current diff with no unresolved findings
  • human review remains required because this changes core rendering

Closes #302

@Happypig375 Happypig375 added Type/Enhancement A concrete change to CSharpMath behavior or capability. Area/Parsing LaTeX tokenization, parsing, commands, and serialization. Area/Rendering Typesetting, measurement, fonts, text layout, and drawing. labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area/Parsing LaTeX tokenization, parsing, commands, and serialization. Area/Rendering Typesetting, measurement, fonts, text layout, and drawing. Type/Enhancement A concrete change to CSharpMath behavior or capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lay out integer long division with \longdiv

1 participant