From feef4fe9ea90e8419e719f946f99fa7d8f053713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Balv=C3=ADn?= Date: Thu, 17 Sep 2026 23:05:41 +0200 Subject: [PATCH] style(encode): reword the negative-zero rationale comments Assisted-by: GLM 5.3 --- encode.go | 3 ++- encode_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/encode.go b/encode.go index 1d4aa05..bf876dd 100644 --- a/encode.go +++ b/encode.go @@ -831,7 +831,8 @@ func (e *encoder) writeFloat(v float64) error { case math.IsInf(v, -1): e.buf.WriteString("-inf") case v == 0: - // Normalise negative zero to positive zero (TOML has no -0). + // Normalise negative zero to positive zero, the contract the output + // rules in the documentation state. e.buf.WriteString("0.0") default: s := strconv.FormatFloat(v, 'g', -1, 64) diff --git a/encode_test.go b/encode_test.go index cb5c8f8..8f03d52 100644 --- a/encode_test.go +++ b/encode_test.go @@ -67,7 +67,7 @@ func TestMarshalFloatSpecials(t *testing.T) { } func TestMarshalFloatNormalizesNegativeZero(t *testing.T) { - // TOML has no -0; the emitter must normalise negative zero to "0.0". + // The output contract normalises negative zero to "0.0". type Cfg struct { Z float64 `toml:"z"` }