internal/impl: fix Has behavior for floats

According to IEEE-754, equality on floats reports true for both +0 and -0.
However, this definition causes us to lose information. Instead, we want
a definition that checks for exact equality with +0.
Otherwise, we would lose the ability to serialize -0.

Change-Id: I36450c24258fc4f856bfd4bc4c53a90199b216b9
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/172970
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/impl/message_test.go b/internal/impl/message_test.go
index ef71ca1..b5a9af2 100644
--- a/internal/impl/message_test.go
+++ b/internal/impl/message_test.go
@@ -387,6 +387,11 @@
 		},
 		clearFields{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22},
 		equalMessage{&ScalarProto3{}},
+
+		// Verify that -0 triggers proper Has behavior.
+		hasFields{6: false, 7: false},
+		setFields{6: V(float32(math.Copysign(0, -1))), 7: V(float64(math.Copysign(0, -1)))},
+		hasFields{6: true, 7: true},
 	})
 
 	// Test read-only operations on nil message.