139 },
140 []*types.MetricData{
141 types.MakeMetricData("metric1 Current:0.00 Max:0.00 Min:-3.00",
142 []float64{-1.0, -2.0, -1.0, -3.0, -1.0, -1.0, -0.0, -0.0, -0.0}, 1, now32).SetNameTag("metric1"),143 },
144 },
145 {
139 },
140 []*types.MetricData{
141 types.MakeMetricData("metric1 Current:0.00 Max:0.00 Min:-3.00",
142 []float64{-1.0, -2.0, -1.0, -3.0, -1.0, -1.0, -0.0, -0.0, -0.0}, 1, now32).SetNameTag("metric1"),143 },
144 },
145 {
139 },
140 []*types.MetricData{
141 types.MakeMetricData("metric1 Current:0.00 Max:0.00 Min:-3.00",
142 []float64{-1.0, -2.0, -1.0, -3.0, -1.0, -1.0, -0.0, -0.0, -0.0}, 1, now32).SetNameTag("metric1"),143 },
144 },
145 {
134 map[parser.MetricRequest][]*types.MetricData{
135 {Metric: "metric1", From: 0, Until: 1}: {
136 types.MakeMetricData("metric1",
137 []float64{-1.0, -2.0, -1.0, -3.0, -1.0, -1.0, -0.0, -0.0, -0.0}, 1, now32),138 },
139 },
140 []*types.MetricData{
134 map[parser.MetricRequest][]*types.MetricData{
135 {Metric: "metric1", From: 0, Until: 1}: {
136 types.MakeMetricData("metric1",
137 []float64{-1.0, -2.0, -1.0, -3.0, -1.0, -1.0, -0.0, -0.0, -0.0}, 1, now32),138 },
139 },
140 []*types.MetricData{
Go constants cannot express negative zero
In IEEE 754 floating point math, zero has a sign and can be positive or negative. This can be useful in certain numerical code.
Go constants, however, cannot express negative zero. This means that the
literals -0.0
and 0.0
have the same ideal value (zero) and will both
represent positive zero at runtime.
func foo() {
negativeZero := -0.0
}
func foo() {
negativeZero := math.Copysign(0, -1)
}