Test if a double precision is a finite number
FT 11.02.2022
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | array_size | |||
double precision, | intent(in), | DIMENSION(:) | :: | array | ||
character(len=*), | intent(in) | :: | name |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i |
SUBROUTINE scan_1d_array_for_nans( array_size, array, name )
!***********************************************
!
!# Test if a double precision is a finite number
!
! FT 11.02.2022
!
!***********************************************
INTEGER, INTENT(IN):: array_size
DOUBLE PRECISION, DIMENSION(:), INTENT(IN):: array
CHARACTER(LEN=*), INTENT(IN):: name
INTEGER:: i
!$OMP PARALLEL DO DEFAULT( NONE ) &
!$OMP SHARED( array, array_size, name ) &
!$OMP PRIVATE( i )
DO i= 1, array_size, 1
IF(.NOT.is_finite_number(array(i)))THEN
PRINT *, "** ERROR! The array ", name, "does not contain a finite", &
" number at position ", i
PRINT *, " * ", name, "(", i, ")=", array(i)
PRINT *
STOP
ENDIF
ENDDO
!$OMP END PARALLEL DO
END SUBROUTINE scan_1d_array_for_nans