Standard library / math
math.IsInf()
Tests infinity; positive sign tests +Inf, negative sign tests -Inf, zero tests either. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func IsInf(f float64, sign int) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| f | float64 | Input floating-point value. |
| sign | int | Sign selector. |
Return Value
bool
Tests infinity; positive sign tests +Inf, negative sign tests -Inf, zero tests either.
Working Example
Example Snippetgo
package main
import ( "fmt" "math")
func main() { fmt.Println(math.IsInf(math.Inf(-1), 0))}