Make the choice of NaN values clearer.

Also switch stale nan value to one more suitable for expansion.
This commit is contained in:
Brian Brazil 2017-05-10 14:56:46 +01:00
parent 95162ebc16
commit 73049ba79d
1 changed files with 8 additions and 2 deletions

View File

@ -18,8 +18,14 @@ import (
)
const (
NormalNaN uint64 = 0x7ff8000000000001 // A quiet NaN. This is also math.NaN().
StaleNaN uint64 = 0x7ff4000000000000 // A signalling NaN, starting 01 to allow for expansion.
// A quiet NaN. This is also math.NaN().
NormalNaN uint64 = 0x7ff8000000000001
// A signalling NaN, due to the MSB of the mantissa being 0.
// This value is chosen with many leading 0s, so we have scope to store more
// complicated values in the future. It is 2 rather than 1 to make
// it easier to distinguish from the NormalNaN by a human when debugging.
StaleNaN uint64 = 0x7ff0000000000002
)
func IsStaleNaN(v float64) bool {