Standard library / math

math.IsNaN()

Tests whether a value is NaN; equality cannot reliably test NaN. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func IsNaN(f float64) (is bool)

Parameters & Attributes

NameTypeDescription
ffloat64Input floating-point value.

Return Value

(is bool)

Tests whether a value is NaN; equality cannot reliably test NaN.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Println(math.IsNaN(math.NaN()))}
Go Reference