Skip to content

FHIRPath 3.0.0: power(), Quantity math, log(), overflow, and mixed-type aggregates #134

Closed

Description

@fjsj

FHIRPath 3.0.0 (spec) changes several math and aggregate rules that the engine still applies as 2.0.0 did. The extended R5 suite in reason-healthcare/rh found them while validating #122; this issue collects them.

3.0.0 says Engine today
power() always returns a Decimal ("Math", power) 2.power(3).is(Integer) is true
ceiling(), floor(), round(), and truncate() take a Quantity (1.5 'mg').ceiling() throws "not defined for System.Quantity"
log() signals an error when the input or the base is 0 or negative 0.log(10) and (-1).log(10) are empty; 10.log(0) is 0
Arithmetic overflow or underflow is empty ("Math" operators) 2147483647 + 1 widens to the Long 2147483648
sum(), min(), and max() throw unless all items are the same type ("Aggregates") (1 | 2.5).sum() is 3.5

Each needs a decision before changing, since some are visible behavior (Long widening, mixed-type aggregates). The analyzer signatures should follow whatever the runtime does (AGENTS.md: shared rules).

Cases: testPower6, testCeiling6, testFloor6, testRound6, testTruncate4, testLogZeroInput, testLogZeroBase, testLogNegativeBase, testPlusOverflow1, testMinusUnderflow1, testPolarityNegateOverflow, testSum5, testMin10, testMax10 in reason-healthcare/rh crates/rh-fhirpath/testlab/tests-fhir-r5.xml.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions