Standard library / math

math.Log1p()

Computes log(1+x) accurately near zero; x below -1 yields NaN. Expected stdout: '0\n'.

Formal Syntax & Structure

go syntaxgo
func Log1p(x float64) float64

Parameters & Attributes

NameTypeDescription
xfloat64First input operand (or sole input if unary).

Return Value

float64

Computes log(1+x) accurately near zero; x below -1 yields NaN.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Println(math.Log1p(0))}
Go Reference