---
schema_version: "1"
id: dd225fb8ada20aa04a20559833d29f19c388ee4b34b613cfef9c09efe244f298
title: logn
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-math-functions-logn.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-math-functions-logn
source_site: docs.mulesoft.com
content_type: documentation
content_hash: fcd36221851e302dfd24001463af49b200908c36f84dfb58bdeed26e21865f2d
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# logn

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## logn(a: Number): Number | NaN

Returns the natural logarithm (base `e`) of a number.

If the input value is less than or equal to zero, the result is `NaN` (or `null`).

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>a</code></p></td><td><div><div><p>Number to convert into its natural logarithm.</p></div></div></td></tr></tbody></table>

### Example

This example shows how `logn` behaves with different inputs.

#### Source

```DataWeave
%dw 2.0
import * from dw::util::Math
output application/json
---
{
   "logn10":  logn(10),
   "logn13": logn(0.13),
   "logn-20": logn(-20)
}
```

#### Output

```Json
{
   "logn10": 2.302585092994046,
   "logn13": -2.0402208285265546,
   "logn-20": null
}
```
