pint units (GEP 10): convert currencies at the column boundary only (never scale parameters)#144
Draft
MImmesberger wants to merge 1 commit into
Draft
Conversation
Parameters will never be scaled; computation runs in the policy date's statutory currency and conversion moves entirely to the column boundary (inputs in, requested targets out). Design and rationale in the PR body; implementation follows on this branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #138; #141 will be re-stacked on top of this branch once the rework lands, picking up the mettsim fallout there.
Problem
Build-time parameter scaling breaks run-currency covariance for any formula that is not homogeneous of degree 1 in its money inputs. The concrete case is gettsim's Wohngeld Basisformel,
1.15 · (M − (a + b·M + c·Y) · Y)— quadratic in the money inputs M and Y. Rescaling M and Y by λ (a currency change) rescales the output by λ only if b and c rescale by 1/λ. Making that work under parameter scaling forces per-coefficient units (a dimensionless, b and c in month/EUR) — confusing, and not how the law states these numbers (plain values whose currency convention is implicit in the statute).Design
Parameters are never scaled. They keep their statutory values in their statutory currency.
This is the definitionally correct semantics — "first calculate in the parameter currency, then convert the result" — so it is exact for arbitrary formula shapes, and statutory formulas keep their published plain-number coefficients as
DIMENSIONLESS.Consequences
RoundingSpecconversion — a DM-era rounding spec rounds in DM natively). The axes declarations keep their checking role.main()changes meaning: from the currency everything is computed in, to the currency the user's data arrives in and results are returned in.Independent second item riding this branch: the
HOURSdenominator in the unit grammar (Mindestlohn is EUR per working hour).Full handoff with touch surface and open sub-questions lives outside the repo (dev-gettsim workspace).
🤖 Generated with Claude Code