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_field.go b/internal/impl/message_field.go
index ec29a9b..436cd28 100644
--- a/internal/impl/message_field.go
+++ b/internal/impl/message_field.go
@@ -6,6 +6,7 @@
 
 import (
 	"fmt"
+	"math"
 	"reflect"
 
 	"github.com/golang/protobuf/v2/internal/flags"
@@ -197,7 +198,7 @@
 			case reflect.Uint32, reflect.Uint64:
 				return rv.Uint() != 0
 			case reflect.Float32, reflect.Float64:
-				return rv.Float() != 0
+				return rv.Float() != 0 || math.Signbit(rv.Float())
 			case reflect.String, reflect.Slice:
 				return rv.Len() > 0
 			default: