Abs in Go

Posted by GoDoc
Public (Editable by Users)

Abs returns the absolute value (also called the modulus) of x.

Go
Edit
package main

import (
	"fmt"
	"math/cmplx"
)

func main() {
	fmt.Printf("%.1f", cmplx.Abs(3+4i))
}