From 6af853258b93599744092557ba5e4fd89461e652 Mon Sep 17 00:00:00 2001 From: Aymen Qader Date: Tue, 5 May 2026 16:45:20 +0000 Subject: [PATCH] Fix complex NRM2 tests for matching infinite results The extended complex NRM2 tests can compare an expected +Inf norm with a computed +Inf norm. The relative-error path then evaluates Inf - Inf, producing NaN and reporting a spurious failure. Treat exactly equal results as zero test ratio before computing the relative difference. This matches the existing SNRM2 and DNRM2 test logic. Fixes #1047. --- BLAS/TESTING/cblat1.f | 2 ++ BLAS/TESTING/zblat1.f | 2 ++ 2 files changed, 4 insertions(+) diff --git a/BLAS/TESTING/cblat1.f b/BLAS/TESTING/cblat1.f index f2f9b2126..09a704676 100644 --- a/BLAS/TESTING/cblat1.f +++ b/BLAS/TESTING/cblat1.f @@ -1033,6 +1033,8 @@ SUBROUTINE CB1NRM2(N,INCX,THRESH) ELSE TRAT = ZERO END IF + ELSE IF (SNRM == ZNRM) THEN + TRAT = ZERO ELSE IF (ZNRM == ZERO) THEN TRAT = SNRM / ULP ELSE diff --git a/BLAS/TESTING/zblat1.f b/BLAS/TESTING/zblat1.f index 71438c420..bcdfa7b28 100644 --- a/BLAS/TESTING/zblat1.f +++ b/BLAS/TESTING/zblat1.f @@ -1033,6 +1033,8 @@ SUBROUTINE ZB1NRM2(N,INCX,THRESH) ELSE TRAT = ZERO END IF + ELSE IF (SNRM == ZNRM) THEN + TRAT = ZERO ELSE IF (ZNRM == ZERO) THEN TRAT = SNRM / ULP ELSE