From patchwork Thu Apr 23 06:34:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 19193 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6F27E44BE23 for ; Thu, 23 Apr 2020 10:02:12 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4A54768BDF8; Thu, 23 Apr 2020 10:02:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C99E268BC1D for ; Thu, 23 Apr 2020 10:02:05 +0300 (EEST) Received: by mail-ed1-f66.google.com with SMTP id j20so3554634edj.0 for ; Thu, 23 Apr 2020 00:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=/MlWK3u1O0BA+1gNCdguq2DRh6WZY2TlG5a5aii9Wd8=; b=0CV1Wvn2bcYDzTCPRym+l5lL8NbrL1oc4MGUnmP2JNAjRzcFOyGCTebhe4AccCxvlx s1Qlo4D578JW4hZhA46T906NRywc3LsYfsrWTFmiHt3BzERBtZ1vUqdKZ7HqTvG+W03i 7tSjko1S/jSOfbuPwaoNb71Q6xWRFbxlItM+9pcUM2AUQXBJTPFdwyTzS0QgMbxatyCg swTdqyQoi+LN63zcWn0UhgqfB9cTrHX47vXob+8KvaYNMREIWGkUBjyB2fii3xwu8UzL HL3vv1K9t25p2euVhtQqe4mihV6xN4w/6AVEE0f5PtfJOzCeSca2nidad77yk1qYsmwo 2Yzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=/MlWK3u1O0BA+1gNCdguq2DRh6WZY2TlG5a5aii9Wd8=; b=PWhULlimz8v6fgZXT67MNnN5n9+eLbwCZi5rdwo2FQutFvWbeePRZBRd1ZY++2uSz0 9EODRx9FJ/pUd4eQGZjGgfqmgcGR5LrUs9LCrvvdmb8O736Y/zSTDsJbhGGiWcNqBjFe V+oUZdbPtWVIku4iR/i7SgjQtcOhekdMs0xCb14vC3wWWLWryPENXIObDloDOkxT2JDK NSMDJgQfpLSzmLHtc2mv0XRtG5MIf4SGTOmqKBmWKFZdRXOmFW9wnlIRKvtVBIGDbG6e VEwNrNoQOyo3fFaVx9kHogyp775+d23j0wAacYjXpivRIOiCsBG1qhjTAxwODcwVy3Q/ 8K3g== X-Gm-Message-State: AGi0PuY5cosEPteIlkHO5UXPJNHMhkgcOqlJ6m/Q2tZTsTDAX4Z14UCn YaHfbsB4j6P7lmzjkNzveopZyyyxXHo= X-Google-Smtp-Source: APiQypIhGaYVRXZ5keOHqlJLGYab/fxFKAW+xAGfC2d21PteRGYMYu/wXBAGOS8mno54ebLlbWtTwQ== X-Received: by 2002:a2e:8686:: with SMTP id l6mr1457588lji.152.1587623644051; Wed, 22 Apr 2020 23:34:04 -0700 (PDT) Received: from localhost.localdomain (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id r20sm963752ljj.44.2020.04.22.23.34.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 23:34:03 -0700 (PDT) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 Apr 2020 09:34:02 +0300 Message-Id: <20200423063402.9591-1-martin@martin.st> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] dnn-layer-mathbinary-test: Fix tests for cases with extra intermediate precision X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This fixes tests on 32 bit x86 mingw with clang, which uses x87 fpu by default. In this setup, while the get_expected function is declared to return float, the compiler is (especially given the optimization flags set) free to keep the intermediate values (in this case, the return value from the inlined function) in higher precision. This results in the situation where 7.28 (which actually, as a float, ends up as 7.2800002098), multiplied by 100, is 728.000000 when really forced into a 32 bit float, but 728.000021 when kept with higher intermediate precision. For the multiplication case, a more suitable epsilon would e.g. be 2*FLT_EPSILON*fabs(expected_output), but just increase the current hardcoded threshold for now. --- tests/dnn/dnn-layer-mathbinary-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dnn/dnn-layer-mathbinary-test.c b/tests/dnn/dnn-layer-mathbinary-test.c index f82d15b14c..f67c0f213b 100644 --- a/tests/dnn/dnn-layer-mathbinary-test.c +++ b/tests/dnn/dnn-layer-mathbinary-test.c @@ -24,7 +24,7 @@ #include "libavfilter/dnn/dnn_backend_native_layer_mathbinary.h" #include "libavutil/avassert.h" -#define EPSON 0.00001 +#define EPSON 0.00005 static float get_expected(float f1, float f2, DNNMathBinaryOperation op) {