--- type: "fhirpath-function" title: "FHIRPath Function: log" function: "log" category: "Math" section: "5.8.6" source: "fhirpath/functions.json" --- # FHIRPath Function: log {:.stu} Returns the logarithm base `base` of the input number. {:.stu} Accepts Decimal input types. Integer and Long types are also accepted via implicit conversion to Decimal. {:.stu} If the input is 0 or negative, the evaluation will end and signal an error to the calling environment. If the base argument is 0 or negative, the evaluation will end and signal an error to the calling environment. {:.stu} If `base` is empty, the result is empty. {:.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 16.log(2) // 4.0 100.0.log(10.0) // 2.0 ``` {:.stu} ## Summary - **Category**: Math - **Section**: `5.8.6` - **Return Type**: `Decimal` - **Empty Input Result**: `empty` - **Errors on Multiple Input**: `true` ## Description Returns the logarithm base `base` of the input number. ## Arguments - `base`: `Decimal` - Base of the logarithm ## Type Mapping - `Integer-Decimal` - `Long-Decimal` - `Decimal-Decimal` ## Example ```fhirpath 16.log(2) // 4.0 100.0.log(10.0) // 2.0 ```