From 73049ba79d2b6a752b0507f80ca09db03425ae39 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Wed, 10 May 2017 14:56:46 +0100 Subject: [PATCH] Make the choice of NaN values clearer. Also switch stale nan value to one more suitable for expansion. --- pkg/value/value.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/value/value.go b/pkg/value/value.go index d0b4942af..a1a427be0 100644 --- a/pkg/value/value.go +++ b/pkg/value/value.go @@ -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 {