type: fhirpath-operatoroperator: /category: Mathsection: 6.6.2source: fhirpath/operations.json
FHIRPath Operator: / (divide)
Divides the left operand by the right operand (supported for Integer, Decimal, and Quantity). The result of a division is always Decimal, even if the inputs are both Integer. For integer division, use the div operator.
If an attempt is made to divide by zero, the result is empty.
For division involving quantities, the resulting quantity will have an appropriate unit:
12 'cm2' / 3 'cm' // 4.0 'cm'
12 / 0 // empty ({ })
Summary
- Category: Math
- Section:
6.6.2 - Left Argument:
Integer | Decimal | Quantity - Right Argument:
Integer | Decimal | Quantity - Return Type:
Decimal | Quantity - Empty Input Result:
empty - Errors on Multiple Input:
true
Description
Divides the left operand by the right operand. The result is always Decimal, even if inputs are Integer. Each operand must be a single element. Division by zero results in empty collection. For quantities, the resulting quantity will have an appropriate unit.
Type Mapping
Integer-IntegerDecimal-DecimalInteger-DecimalDecimal-IntegerQuantity-Quantity