We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3a5161 commit 15e768dCopy full SHA for 15e768d
1 file changed
assert/assertions_test.go
@@ -170,6 +170,23 @@ func TestObjectsAreEqualValues(t *testing.T) {
170
{float32(10.123456), float64(10.12345600), true},
171
{float32(10.123456), float64(10.12345678), false},
172
{float32(1.0 / 3.0), float64(1.0 / 3.0), false},
173
+
174
+ // Something near overflow should work
175
+ {float32(math.MaxFloat32), float64(math.MaxFloat32), true},
176
177
+ // NaN should remain unequal, even across float32/float64.
178
+ {float32(math.NaN()), float64(math.NaN()), false},
179
180
+ // Infinity should compare like ordinary equality.
181
+ {float32(math.Inf(1)), float64(math.Inf(1)), true},
182
+ {float32(math.Inf(-1)), float64(math.Inf(-1)), true},
183
+ {float64(math.Inf(1)), float32(math.Inf(-1)), false},
184
185
+ // zero should not lead to division by zero error
186
+ {float32(0), float64(0), true},
187
188
+ // Signed zero should still compare equal.
189
+ {float32(math.Copysign(0, -1)), float64(0), true},
190
}
191
192
for _, c := range cases {
0 commit comments