1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
From: =?utf-8?b?IkNoYW5nWmh1byBDaGVuICjpmbPmmIzlgKwpIg==?=
<czchen@debian.org>
Date: Sat, 10 Sep 2022 00:22:22 +0800
Subject: compare float with epsilon
---
ciede2000_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ciede2000_test.go b/ciede2000_test.go
index 1462b8b..5f1db8a 100644
--- a/ciede2000_test.go
+++ b/ciede2000_test.go
@@ -10,7 +10,7 @@ func TestDiff(t *testing.T) {
c2 := &color.RGBA{50, 60, 255, 255}
value := Diff(c1, c2)
expected := 101.84978806864332
- if value != expected {
+ if value-expected > 0.0000000001 {
t.Fatalf("Expected %v, but %v:", expected, value)
}
}
|