# GoLang – Find Cosine – Cos() Function – Examples & Explanation

`Cos()` function is used to find the cosine of the given input (`x` – parameter) in Go language.
The standard math package of Go programming language has `Cos()` function. The purpose of this function is to show the cosine of the argument `x` (where `x` is a radian value).

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

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

```func Cos(x float64) float64
```

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

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

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

## Error Handling

If the `x ` parameter is not a number (numeric value) `Cos()` 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 `Cos()` Function in Go Language

`Cos()` function will return the cosine of the given input(`x ` – parameter in radian).

## GoLang `Cos()` Function Example 1

```package main

import "fmt"
import "math"

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

Output:
` 0.5253219888177297 `

## GoLang `Cos()` Function Example 2

```package main

import "fmt"
import "math"

func main() {
var x float64
x = math.Cos(0)
fmt.Println(x)
}
```

Output:
` 1 `

## GoLang `Cos() ` Function Example 3

```package main

import "fmt"
import "math"

func main() {
var x float64
x = math.Cos(6.39)
fmt.Println(x)
}
```

Output:
` 0.994300732549815`