Standard library / math/cmplx

cmplx.Log()

Principal natural logarithm: real part log magnitude, imaginary part phase. Expected stdout: '0 0\n'.

Formal Syntax & Structure

go syntaxgo
func Log(x complex128) complex128

Parameters & Attributes

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

Return Value

complex128

Principal natural logarithm: real part log magnitude, imaginary part phase.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math/cmplx")
func main() {  z := cmplx.Log(1)  fmt.Printf("%.6g %.6g\n", real(z)+0.0, imag(z)+0.0)}
Go Reference