Menu Close

Go – How to get an IEEE 754 not-a-number value in go

Here, We will learn how to get an IEEE 754 not-a-number value in go. We can get it by using NaN() function in math package in go golang.

Function prototype:

func NaN() float64

Return value:

NaN() function in math package returns 
an IEEE 754 “not-a-number” value.

Example with code:

package main

import (
  "fmt"
  "math"
)

func main() {

  no := math.NaN()
  fmt.Println(no)

}

Output:

NaN

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.

Contact Us