--- type: "fhirpath-function" title: "FHIRPath Function: round" function: "round" category: "Math" section: "5.8.8" source: "fhirpath/functions.json" --- # FHIRPath Function: round {:.stu} > [Discussion on this topic](https://chat.fhir.org/#narrow/stream/179266-fhirpath/topic/round.28.29.20for.20negative.20numbers) If you have specific proposals or feedback please log a change request. {: .stu-note } Rounds the input to the nearest whole number using a traditional round (i.e. to the nearest whole number), meaning that a decimal value greater than or equal to 0.5 and less than 1.0 will round to 1, and a decimal value less than or equal to -0.5 and greater than -1.0 will round to -1. If specified, the precision argument determines the decimal place at which the rounding will occur. If not specified, the rounding will default to 0 decimal places. {:.stu} If specified, the number of digits of precision must be >= 0 or the evaluation will end and signal an error to the calling environment. {:.stu} Accepts input types of Decimal, or Quantity. {:.stu} When used with a Decimal input type, the result is an Decimal.
When used with a Quantity, the result is a Quantity with the same units. {:.stu} When used with Integer or Long, the arguments will be implicitly converted to Decimal before evaluation. {:.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 1.round() // 1 3.14159.round(3) // 3.142 ``` {:.stu} ## Summary - **Category**: Math - **Section**: `5.8.8` - **Return Type**: `Decimal | Quantity` - **Empty Input Result**: `empty` - **Errors on Multiple Input**: `true` ## Description Rounds the input to the nearest whole number using a traditional round (i.e. to the nearest whole number), meaning that a decimal value greater than or equal to 0.5 and less than 1.0 will round to 1, and a decimal value less than or equal to -0.5 and greater than -1.0 will round to -1. If specified, the precision argument determines the decimal place at which the rounding will occur. If not specified, the rounding will default to 0 decimal places. ## Arguments - `precision` (optional): `Integer` - Optional decimal places to round to ## Type Mapping - `Integer-Decimal` - `Long-Decimal` - `Decimal-Decimal` - `Quantity-Quantity` ## Example ```fhirpath 1.round() // 1 3.14159.round(3) // 3.142 ```