---
title: math.log1p() function
description: 'math.log1p() returns the natural logarithm of 1 plus x. This operation is more accurate than math.log(x: 1 + x) when x is near zero.'
url: https://docs.influxdata.com/flux/v0/stdlib/math/log1p/
estimated_tokens: 1412
product: Flux
version: v0
---

# math.log1p() function

-   Flux 0.22.0+
-   View InfluxDB support

`math.log1p()` returns the natural logarithm of 1 plus `x`. This operation is more accurate than `math.log(x: 1 + x)` when `x` is near zero.

##### Function type signature

```js
(x: float) => float
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### x

(Required) Value to operate on.

## Examples

-   [Return the natural logarithm of values near zero](#return-the-natural-logarithm-of-values-near-zero)
-   [Use math.log1p in map](#use-mathlog1p-in-map)

### Return the natural logarithm of values near zero

```js
import "math"

math.log1p(x: 0.56)// 0.44468582126144574

```

### Use math.log1p in map

```js
import "math"

data
    |> map(fn: (r) => ({r with _value: math.log1p(x: r._value)}))
```

[](#view-example-input-and-output)

View example input and output

#### Input data

| _time | *tag | _value |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | t1 | -0.021800000000000003 |
| 2021-01-01T00:00:10Z | t1 | 0.1092 |
| 2021-01-01T00:00:20Z | t1 | 0.0735 |
| 2021-01-01T00:00:30Z | t1 | 0.1753 |
| 2021-01-01T00:00:40Z | t1 | 0.15230000000000002 |
| 2021-01-01T00:00:50Z | t1 | 0.0443 |

| _time | *tag | _value |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | t2 | 0.1985 |
| 2021-01-01T00:00:10Z | t2 | 0.0497 |
| 2021-01-01T00:00:20Z | t2 | -0.0375 |
| 2021-01-01T00:00:30Z | t2 | 0.1977 |
| 2021-01-01T00:00:40Z | t2 | 0.1386 |
| 2021-01-01T00:00:50Z | t2 | 0.018600000000000002 |

#### Output data

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | -0.02204113087688024 | t1 |
| 2021-01-01T00:00:10Z | 0.10363903475948592 | t1 |
| 2021-01-01T00:00:20Z | 0.07092433833669866 | t1 |
| 2021-01-01T00:00:30Z | 0.1615234341566714 | t1 |
| 2021-01-01T00:00:40Z | 0.14175994503783176 | t1 |
| 2021-01-01T00:00:50Z | 0.04334680450336586 | t1 |

| _time | _value | *tag |
| --- | --- | --- |
| 2021-01-01T00:00:00Z | 0.181070774892302 | t2 |
| 2021-01-01T00:00:10Z | 0.048504409059614985 | t2 |
| 2021-01-01T00:00:20Z | -0.03822121282019776 | t2 |
| 2021-01-01T00:00:30Z | 0.18040305097132403 | t2 |
| 2021-01-01T00:00:40Z | 0.12979943753484446 | t2 |
| 2021-01-01T00:00:50Z | 0.018429135468367195 | t2 |
