Skip to content

Stop the sum filter rounding integer totals - #30

Closed
qoke wants to merge 2 commits into
ardanlabs:mainfrom
iqhive:jinjafix-integer-sum-precision
Closed

qoke wants to merge 2 commits into
ardanlabs:mainfrom
iqhive:jinjafix-integer-sum-precision

Conversation

@qoke

@qoke qoke commented Oct 22, 2026

Copy link
Copy Markdown

Closes #18.

The sum filter was accumulating integer inputs using floating-point arithmetic. That made [9007199254740993, 2] | sum return 9007199254740994 instead of 9007199254740995.

The accumulator now starts as an integer and uses the engine’s existing addition operation for each item. Integer inputs stay in integer arithmetic, while floating-point inputs follow the existing numeric promotion behaviour.

This fixes precision loss within the supported integer range. It doesn’t add arbitrary-precision integers or general overflow handling.

The regression test checks the exact rendered result against Python’s output. It captures the incorrect Go result before the fix and passes afterwards.

@ardan-bkennedy

Copy link
Copy Markdown
Contributor

Thank you, @qoke, for reporting these issues and for providing proposed fixes. We reviewed all nine reports and used your suggestions where they made sense in the codebase. All nine issues have now been resolved in #34, each with corresponding regression tests, and the fixes are published in v1.11.0.

The issue addressed by this PR (#18) is covered by that release, so we are closing this PR in favor of the consolidated fix.

For future reports, please start with issues only so we can discuss the approach before opening pull requests. Thanks again for helping improve the project.

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.

Stop the sum filter rounding integer totals

2 participants