github.com/hsfzxjy/dgo/go@v0.2.0/ieee754_utils.go (about)

     1  package dgo
     2  
     3  import (
     4  	"math"
     5  )
     6  
     7  const _canonicalNANbits uint64 = 0xFFFF_FFFF_FFFF_FFFF
     8  
     9  func canonicalizeNAN(x float64) float64 {
    10  	if math.IsNaN(x) {
    11  		return math.Float64frombits(_canonicalNANbits)
    12  	}
    13  	return x
    14  }