# GoLang – Show Positive Infinity – Inf() Function – Examples & Explanation

`Inf()` function is used to show the positive infinity if sign `>= 0`, negative infinity if sign` < 0` of the given input (`x` – parameter) in Go language. The standard math package of Go programming language has `Inf()` function.

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

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

```func Inf(sign int) float64
```

Note: `float64` is a data type in Go language which has IEEE-754 64-bit floating-point numbers. And `int` is a signed integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, int32.

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

`x ` – Where `x` is any Valid `int` Input value (positive or negative). This parameter is required.

## Error Handling

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

`Inf()` function will return positive infinity if sign `>= 0`, negative infinity if sign `< 0` of the given input(`x ` – parameter).

## GoLang `Inf()` Function Example 1

```package main

import "fmt"
import "math"

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

Output:
` -Inf`

## GoLang `Inf()` Function Example 2

```package main

import "fmt"
import "math"

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

Output:
` +Inf`

## GoLang `Inf() ` Function Example 3

```package main

import "fmt"
import "math"

func main() {
var x float64
x = math.Inf(3698)
fmt.Println(x)
}
```

Output:
` +Inf`