From e3ce736ce27309f32a13e299f3e815314760fcb2 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Fri, 26 May 2023 09:34:15 +0200 Subject: [PATCH] app/vmselect/graphite: fixes tests for arm (#4348) at arm based CPUs only 9 digits after comma matches for tests. Especially at holtWinters functions. Since it only takes effect at tests it makes no sense for changing float prescision at actual functions (cherry picked from commit 228ea03bda0eda3507d782cb627d946843f29c30) --- app/vmselect/graphite/eval_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/vmselect/graphite/eval_test.go b/app/vmselect/graphite/eval_test.go index 5786c56c43..a817120ed8 100644 --- a/app/vmselect/graphite/eval_test.go +++ b/app/vmselect/graphite/eval_test.go @@ -3980,6 +3980,7 @@ func compareSeries(ss, ssExpected []*series, expr graphiteql.Expr) error { if !reflect.DeepEqual(s.Timestamps, sExpected.Timestamps) { return fmt.Errorf("unexpected timestamps for series %q\ngot\n%d\nwant\n%d", s.Name, s.Timestamps, sExpected.Timestamps) } + if !equalFloats(s.Values, sExpected.Values) { return fmt.Errorf("unexpected values for series %q\ngot\n%g\nwant\n%g", s.Name, s.Values, sExpected.Values) } @@ -4012,7 +4013,7 @@ func equalFloats(a, b []float64) bool { } else if math.IsNaN(v2) { return false } - eps := math.Abs(v1) / 1e15 + eps := math.Abs(v1) / 1e9 if math.Abs(v1-v2) > eps { return false }