From fedfb6091a0d3ffa7b0dcf945af91123f84c7ee1 Mon Sep 17 00:00:00 2001 From: Dominic Symes Date: Tue, 9 Apr 2024 12:38:16 +0100 Subject: Main Conformance: Correct err_bnd check When err_bnd is large enough to allow a different result sign from the reference then a negative ref_min may occur. Signed-off-by: Dominic Symes Change-Id: I1603ed43499e385eb2d93494237a910947bb11d1 --- pseudocode/library/tosa_reference_check.tosac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pseudocode/library/tosa_reference_check.tosac b/pseudocode/library/tosa_reference_check.tosac index 79bd4a6..36464bf 100644 --- a/pseudocode/library/tosa_reference_check.tosac +++ b/pseudocode/library/tosa_reference_check.tosac @@ -32,7 +32,8 @@ bool tosa_reference_check_fp_bnd(in_t test_value, fp64_t ref_value, fp64_t if (ref_max > normal_max) ref_max = infinity; if (ref_min > normal_max) ref_min = infinity; if (ref_max < normal_min) ref_max = normal_min; - if (ref_min < normal_min) ref_min = 0; + // Large error bounds could cause ref_min to be negative. + if (ref_min < normal_min) ref_min = min(0, ref_min); return (static_cast(test_value) >= ref_min && static_cast(test_value) <= ref_max); } -- cgit v1.2.1