Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

GoLang – Find Error Function – Erf() Function – Examples & Explanation

Erf() function is used to find the error function of the given input (x – parameter) in Go language. The standard math package of Go programming language has Erf() function. The purpose of this function is to find the error function.

Syntax of Erf() Function in Go Language

The syntax of Erf() function in Go Language is:

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

 

Parameters of Erf() Function in Go Language

x – Where x is any Valid float64 Input value. This parameter is required.

 

Error Handling

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

Erf() function will return the error function of the given input(x – parameters).

 

GoLang Erf() Function Example 1


Output:
-1

 

GoLang Erf() Function Example 2


Output:
0.9946169787747117

 

GoLang Erf() Function Example 3


Output:
0

 

LearnAndLearn.com © 2018 - All rights reserved