diff --git a/BLAS/SRC/icamax.f90 b/BLAS/SRC/icamax.f90 index 192f5ccb5..1b658f74b 100644 --- a/BLAS/SRC/icamax.f90 +++ b/BLAS/SRC/icamax.f90 @@ -103,14 +103,14 @@ integer function icamax(n, x, incx) if (incx == 1) then ! code for increment equal to 1 do i = 1, n - if (isnan(real(x(i))) .or. isnan(imag(x(i)))) then + if (x(i) /= x(i)) then ! return when first NaN found icamax = i return elseif (abs(real(x(i))) > hugeval .or. abs(imag(x(i))) > hugeval) then ! keep looking for first NaN do j = i+1, n - if (isnan(real(x(j))) .or. isnan(imag(x(j)))) then + if (x(j) /= x(j)) then ! return when first NaN found icamax = j return @@ -144,7 +144,7 @@ integer function icamax(n, x, incx) ! code for increment not equal to 1 ix = 1 do i = 1, n - if (isnan(real(x(ix))) .or. isnan(imag(x(ix)))) then + if (x(ix) /= x(ix)) then ! return when first NaN found icamax = i return @@ -152,7 +152,7 @@ integer function icamax(n, x, incx) ! keep looking for first NaN jx = ix + incx do j = i+1, n - if (isnan(real(x(jx))) .or. isnan(imag(x(jx)))) then + if (x(jx) /= x(jx)) then ! return when first NaN found icamax = j return diff --git a/BLAS/SRC/izamax.f90 b/BLAS/SRC/izamax.f90 index c36e623ea..2ce854117 100644 --- a/BLAS/SRC/izamax.f90 +++ b/BLAS/SRC/izamax.f90 @@ -103,14 +103,14 @@ integer function izamax(n, x, incx) if (incx == 1) then ! code for increment equal to 1 do i = 1, n - if (isnan(real(x(i))) .or. isnan(imag(x(i)))) then + if (x(i) /= x(i)) then ! return when first NaN found izamax = i return elseif (abs(real(x(i))) > hugeval .or. abs(imag(x(i))) > hugeval) then ! keep looking for first NaN do j = i+1, n - if (isnan(real(x(j))) .or. isnan(imag(x(j)))) then + if (x(j) /= x(j)) then ! return when first NaN found izamax = j return @@ -144,7 +144,7 @@ integer function izamax(n, x, incx) ! code for increment not equal to 1 ix = 1 do i = 1, n - if (isnan(real(x(ix))) .or. isnan(imag(x(ix)))) then + if (x(ix) /= x(ix)) then ! return when first NaN found izamax = i return @@ -152,7 +152,7 @@ integer function izamax(n, x, incx) ! keep looking for first NaN jx = ix + incx do j = i+1, n - if (isnan(real(x(jx))) .or. isnan(imag(x(jx)))) then + if (x(jx) /= x(jx)) then ! return when first NaN found izamax = j return