Standard library / math

math.Cos()

Cosine of angle in radians. Expected stdout: '1\n'.

Formal Syntax & Structure

go syntaxgo
func Cos(x float64) float64

Parameters & Attributes

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

Return Value

float64

Cosine of angle in radians.

Working Example

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