Preserve decimal EMV2 branch probabilities 馃 - #3256
Merged
Merged
Conversation
Reproduce false probability-sum errors for decimal property values, including property constants, exponent notation, and decimals beyond double precision. Preserve rejection of genuinely incorrect sums and exhausted others branches.
Construct branch-property probabilities from the original real-literal token after resolving constants, avoiding both binary double expansion and loss of source precision. Use BigDecimal.valueOf only when source nodes are unavailable and preserve existing sum diagnostics.
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.
Fixes #2820
Branch-probability validation now constructs property probabilities from their original decimal text. Previously, constructing
BigDecimalfrom the property'sdoubleintroduced binary rounding error, so even0.2 + 0.8could fail the sum-to-one check.The validator reads the real literal's value node after resolving property constants, accepts signed/exponent/underscore notation, and falls back to
BigDecimal.valueOfwhen a literal has no node model. The change is local to branch validation.Issue2820Testcovers ordinary decimal values, constants, exponent notation, values beyond double precision, and a positiveothersremainder smaller than double precision can preserve. Separate invalid models verify that incorrect literal/property sums and an exhaustedothersremainder still produce errors. Before the fix, all five valid cases produced false sum diagnostics.Validation:
verifywith-Dtest=Issue2820Test: 2 tests passed.clean install: 1,689 tests passed, including all 307 EMV2 tests; 0 failures/errors/skips.git diff --checkpassed.Build flags:
mvn -o -T5 -s releng/osate.releng/settings.xml -Plocal -Dpr.build=true -Dsign=false -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false -DfailIfNoTests=false. The focused run uses-pl :org.osate.xtext.aadl2.errormodel,:org.osate.aadl2.errormodel.tests,:org.osate.xtext.aadl2.errormodel.feature -Dtycho.localArtifacts=default; the root run uses-Dtycho.localArtifacts=ignore clean install.No dependency on another unmerged PR. Missing-property handling remains outside this change; #2821 addresses it separately. Models without source nodes retain the precision of their stored double values.