# GoLang – Find Natural Logarithm – Log1p() Function – Examples & Explanation

`Log1p()` function is used to find the natural logarithm of `1` plus its argument `x`. It is more accurate than `Log(1 + x) ` when `x` is near `zero`. The standard math package of Go programming language has `Log1p()` function.

## Syntax of `Log1p()` Function in Go Language

The syntax of `Log1p()` function in Go Language is:

```func Log1p(x float64) float64
```

Note: `float64` is a data type in Go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
```Log1p(+Inf) = +Inf Log1p(±0) = ±0 Log1p(-1) = -Inf Log1p(x < -1) = NaN Log1p(NaN) = NaN```

## Parameters of `Log1p()` Function in Go Language

`x ` – Where `x` is any Valid `float64` Input value. This parameter is required.

## Error Handling

If the `x ` parameter is not a number (numeric value) `Log1p()` function returns an `error `.
If there is no argument (`x` – input value) passes to the function, then the compiler will produce an `error`.

## Return Value of `Log1p()` Function in Go Language

`Log1p()` function will return the natural logarithm of `1` plus its parameter `x`. It is more accurate than `Log(1 + x) ` when `x` is near `zero`.

## Go `Log1p()` Function Example 1

```package main

import "fmt"
import "math"

func main() {
var x float64
x = math.Log1p(-7.63)
fmt.Println(x)
}
```

Output:
` NaN `

## GoLang `Log1p()` Function Example 2

```package main

import "fmt"
import "math"

func main() {
var x float64
x = math.Log1p(4.33)
fmt.Println(x)
}
```

Output:
` 1.6733512381777533`

## GoLang `Log1p() ` Function Example 3

```package main

import "fmt"
import "math

func main() {
var x float64
x = math.Log1p(2)
fmt.Println(x)
}
```

Output:
` 1.0986122886681096 `