Fix Exp/Ln/Log to return null on non-representable results (#1716)#1804
Open
c-schuler wants to merge 3 commits into
Open
Fix Exp/Ln/Log to return null on non-representable results (#1716)#1804c-schuler wants to merge 3 commits into
c-schuler wants to merge 3 commits into
Conversation
Related IssuesThe following open issues may be related to this PR:
|
|
Formatting check succeeded! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1804 +/- ##
=========================================
Coverage 68.75% 68.76%
Complexity 1699 1699
=========================================
Files 536 536
Lines 30559 30555 -4
Branches 7013 7012 -1
=========================================
- Hits 21011 21010 -1
+ Misses 6994 6989 -5
- Partials 2554 2556 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
brynrhodes
approved these changes
Jul 9, 2026
|
antvaset
approved these changes
Jul 10, 2026
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.



Problem
Exp(1000) and Ln(0) threw exceptions instead of returning null. The CQL spec is explicit for all three operators:
Fix
Replaced the exception-based handling with an explicit isInfinite() / isNaN() check that returns null when the result can't be represented as a Decimal. This also removes the UndefinedResult machinery (net-negative lines) and closes the Log gap.
Tests
Un-doctored the vendored engine-fhir copy of CqlArithmeticFunctionsTest.xml - these had been marked invalid="true" to match the old throwing behavior:
Validated: spotlessApply, :engine:detekt, full :engine:jvmTest, full :engine-fhir:test - all green.
Upstream follow-up
The canonical cql-tests (https://github.com/cqframework/cql-tests) suite still marks Exp1000 and Ln0 as invalid="true", which now contradicts the explicit spec clause above. A companion PR to cql-tests is needed to change these to expect null; until then the conformance dashboard will report them as failing.
Fixes #1716.