complx.NaN() Function in Golang With Examples
Last Updated :
28 Apr, 2020
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:
package main
import (
"fmt"
"math/cmplx"
)
func main() {
fmt.Printf( "%.1f" , cmplx.NaN())
}
|
Output:
(NaN+NaNi)
Example 2:
package main
import (
"fmt"
"math/cmplx"
)
func main() {
fmt.Printf( "%t" , cmplx.IsNaN(cmplx.NaN()))
}
|
Output:
true
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...