--- type: "fhirpath-function" title: "FHIRPath Function: abs" function: "abs" category: "Math" section: "5.8.1" source: "fhirpath/functions.json" --- # FHIRPath Function: abs {:.stu} Returns the absolute value of the input (in the same type). When taking the absolute value of a quantity, the unit is unchanged. {:.stu} Accepts input types of Integer, Long, Decimal or Quantity. {:.stu} If the input collection is empty, the result is empty. {:.stu} If the input collection contains multiple items, the evaluation of the expression will end and signal an error to the calling environment. {:.stu} ``` fhirpath (-5).abs() // 5 (-5.5).abs() // 5.5 (-5.5 'mg').abs() // 5.5 'mg' ``` {:.stu} ## Summary - **Category**: Math - **Section**: `5.8.1` - **Return Type**: `Integer | Long | Decimal | Quantity` - **Empty Input Result**: `empty` - **Errors on Multiple Input**: `true` ## Description Returns the absolute value of the input. When taking the absolute value of a quantity, the unit is unchanged. ## Arguments - none ## Type Mapping - `Integer-Integer` - `Long-Long` - `Decimal-Decimal` - `Quantity-Quantity` ## Example ```fhirpath (-5).abs() // 5 (-5.5).abs() // 5.5 (-5.5 'mg').abs() // 5.5 'mg' ```