aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2024-04-09 12:38:16 +0100
committerDominic Symes <dominic.symes@arm.com>2024-04-15 13:40:26 +0000
commitfedfb6091a0d3ffa7b0dcf945af91123f84c7ee1 (patch)
tree7b62467918daaa90af2ad7c833ded0f574d67d21
parent6bf6ac8858b378bcff48ee629315aa53e0c2872a (diff)
downloadspecification-fedfb6091a0d3ffa7b0dcf945af91123f84c7ee1.tar.gz
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 <dominic.symes@arm.com> Change-Id: I1603ed43499e385eb2d93494237a910947bb11d1
-rw-r--r--pseudocode/library/tosa_reference_check.tosac3
1 files changed, 2 insertions, 1 deletions
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>(in_t test_value, fp64_t ref_value, fp64_t
if (ref_max > normal_max<in_t>) ref_max = infinity;
if (ref_min > normal_max<in_t>) ref_min = infinity;
if (ref_max < normal_min<in_t>) ref_max = normal_min<in_t>;
- if (ref_min < normal_min<in_t>) ref_min = 0;
+ // Large error bounds could cause ref_min to be negative.
+ if (ref_min < normal_min<in_t>) ref_min = min(0, ref_min);
return (static_cast<fp64_t>(test_value) >= ref_min &&
static_cast<fp64_t>(test_value) <= ref_max);
}