Menu Close

Go – How to get complementary error function of number

Here, We will learn how to get complementary error function of number in go. We can get it by using Erfc() function in math package in go golang.

Function prototype:

func Erfc(no float64) float64

Return value:

Erfc() function in math package returns
complementary error function of number.

Example with code:

package main

import (
  "fmt"
  "math"
)

func main() {

  no := math.Erfc(10)
  fmt.Printf("%0.2f\n", no)

  no = math.Erfc(-1)
  fmt.Printf("%0.2f\n", no)

  no = math.Erfc(0.25)
  fmt.Printf("%0.2f\n", no)

  no = math.Erfc(200)
  fmt.Printf("%0.2f\n", no)
}

Output:

0.00
1.84
0.72
0.00

To learn more about golang, Please refer given below link:

https://www.techieindoor.com/go-lang-tutorial/

References:

https://golang.org/doc/
https://golang.org/pkg/
Posted in golang, math

Leave a Reply

Your email address will not be published. Required fields are marked *