complx.IsInf() Function in Golang With Examples Last Updated : 28 Apr, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report complx.IsInf() Function in Golang reports whether either real(x) or imag(x) is an infinity. The returned value is boolean. Syntax: func IsInf(x complex128) bool Here, x is the set of all complex numbers with float64 real as well as imaginary parts. Return Value: This returns a boolean value, either true or false. Example 1: This example checks whether 1+5i is infinity or not. C // Golang program to illustrate // the complx.IsInf() Function package main // importing fmt and math/cmplx import ( "fmt" "math/cmplx" ) // Calling Main() func main() { // creating a complex number 1 + 5i infy := complex(1, 5) // checking if it is infinity or not? fmt.Printf("%t", cmplx.IsInf(infy)) } Output: false Example 2: This example verifies that the var infy is infinite or not. C // Golang program to illustrate // the complx.IsInf() Function package main // importing fmt and math/cmplx import ( "fmt" "math" "math/cmplx" ) // Calling Main method func main() { // creating infinity variable. inf := math.Inf(1) // creating infinity complex // number i.e. (INF + INFi) infy := complex(inf, inf) // checking if it is infinity. fmt.Printf("%t", cmplx.IsInf(infy)) } Output: true Comment More infoAdvertise with us Next Article complx.Inf() Function in Golang With Examples P PranchalKatiyar Follow Improve Article Tags : Go Language Golang-Complex Similar Reads complx.Inf() Function in Golang With Examples complx.Inf() Function in Golang is used to returns a complex infinity, complex(+Inf, +Inf). TO use this function one must need to import the "math/cmplx" package. Syntax: func Inf() complex128 Return Type: It returns a complex infinity. Example 1: C // Golang program to illustrate // the complx.Inf( 1 min read complx.IsNaN() Function in Golang With Examples In Go language, cmplx packages supply basic constants as well as mathematical functions for the complex numbers. The IsNaN() function in Go language is used to check if either the stated real(x) or imag(x) is NaN or not and is neither an infinity. Moreover, this function is defined under the cmplx p 1 min read complx.NaN() Function in Golang With Examples complx.NaN() function in Golang is used to returns a complex ânot-a-numberâ value. Syntax: func NaN() complex128 It returns the complex NaN value. Let us discuss this concept with the help of given examples: Example 1: C // Golang program to illustrate // the complx.NaN() Function package main impor 1 min read strings.Compare() Function in Golang with Examples The Compare() function is an inbuilt function in the Golang programming language which is used to compare two strings. It is used to compare two strings in lexicographical order (order in which the words are arranged alphabetically, similar to the way we search words in dictionary) or to find out if 2 min read math.Inf() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find positive infinity (if sign >= 0) or negative infinity (if sign < 0) with the help of the Inf() function provided by the math 2 min read strings.Contains Function in Golang with Examples strings.Contains Function in Golang is used to check the given letters present in the given string or not. If the letter is present in the given string, then it will return true, otherwise, return false. Syntax:Â func Contains(str, substr string) bool Here, str is the original string and substr is t 2 min read Like