From 9402651ef570f3728fe5c837a9b2f4aee41ee7c9 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 14 Aug 2023 22:26:33 +0200 Subject: [PATCH] Add NaN tests --- kernel/riscv64/iamax.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/riscv64/iamax.c b/kernel/riscv64/iamax.c index 8c016ce4d..4d62354e5 100644 --- a/kernel/riscv64/iamax.c +++ b/kernel/riscv64/iamax.c @@ -56,13 +56,15 @@ BLASLONG CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x) BLASLONG max=0; if (n <= 0 || inc_x <= 0) return(max); - + if (n==1) return(1); + if (x[0]!=x[0]) return(1); maxf=ABS(x[0]); ix += inc_x; i++; while(i < n) { + if (x[ix]!=x[ix]) return(i+1); if( ABS(x[ix]) > maxf ) { max = i;