Skip to content

fix(pdf): preserve calculator operand types and operator semantics - #1147

Merged
andiwand merged 1 commit into
mainfrom
review/129-pdf-calculator-types
Oct 6, 2026
Merged

andiwand merged 1 commit into
mainfrom
review/129-pdf-calculator-types

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Calculator functions represented every operand as a real number, so 0 not produced 1 and booleans could participate in arithmetic. Preserve numeric types and boolean values, require the operand types each operator accepts, correct zero-filling right shifts and half-way rounding, and reject undefined arithmetic instead of substituting values mid-program.

Operator behavior follows ISO 32000-1 §7.10.5 and the PostScript Language Reference, third edition, §8.2. Invalid execution keeps the existing zero-result fallback. Ghostscript rejects the same programs: real operands to mod, idiv and bitshift, division by zero, a numeric if condition, a boolean result and not on a real.

Validation: 19 regression assertions fail on the parent. All 141 targeted tests and 50 PDF corpus metadata/HTML-generation checks pass. LLVM 22 clang-tidy and NDK 28.1, emsdk 3.1.73 and iOS 15 object compilation pass, alongside the native macOS 12 build.

@andiwand
andiwand force-pushed the review/128-pdf-function-numbers branch from 0666414 to e7e3cea Compare October 6, 2026 14:47
Base automatically changed from review/128-pdf-function-numbers to main October 6, 2026 14:49
@andiwand
andiwand force-pushed the review/129-pdf-calculator-types branch from 759f921 to 17166d2 Compare October 6, 2026 14:53
@andiwand
andiwand merged commit 45ac963 into main Oct 6, 2026
28 of 29 checks passed
@andiwand
andiwand deleted the review/129-pdf-calculator-types branch October 6, 2026 14:59
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.

1 participant