Erfc()
function is used to find the complementary error function of the given input (x
– parameter) in Go language. The standard math package of Go programming language has Erfc()
function. The purpose of this function is to find the complementary error function.
Syntax of Erfc()
Function in Go Language
The syntax of
Erfc()
function in Go Language is:
func Erfc(x float64) float64
Note: float64
is a data type in Go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
Erfc(+Inf) = 0
Erfc(-Inf) = 2
Erfc(NaN) = NaN
Parameters of Erfc()
Function in Go Language
x
– Where x
is any Valid float64
Input value. This parameter is required.
Error Handling
If the
If there is no argument (
x
parameter is not a number (numeric value) Erfc()
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 Erfc()
Function in Go
Erfc()
function will return the complementary error function of the given input(x
– parameter).
GoLang Erfc()
Function Example 1
package main import "fmt" import "math" func main() { var x float64 x = math.Erfc(7) fmt.Println(x) }
Output:
4.183825607779414e-23
GoLang Erfc()
Function Example 2
package main import "fmt" import "math" func main() { var x float64 x = math.Erfc(-20) fmt.Println(x) }
Output:
2
GoLang Erfc()
Function Example 3
package main import "fmt" import "math" func main() { var x float64 x = math.Erfc(0) fmt.Println(x) }
Output:
1