is_nan Interface

public interface is_nan

Determines if the value of the input variable is NaN.

Syntax

 n = is_nan(f)

Where:

  • f: Real number to check if it is NaN.

It returns True if the number is NaN and False otherwise.

Example

The following program checks some real numbers to see if they are NaN:

 PROGRAM is_nanExample
    USE FU_Numbers, ONLY: is_nan
    IMPLICIT NONE
    REAL :: f
    WRITE(*,*) is_nan(5.)
    f = 0.
    WRITE(*,*) is_nan(1/f)
    WRITE(*,*) is_nan(f/f)
 END PROGRAM is_nanExample

Contents


Module Procedures

private elemental function is_nan_sp(val) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: val

Value to analize. It can have any rank and dimension

Return Value logical

True if the variable is NaN. False otherwise. It will have the same rank and dimension as the input value.

private elemental function is_nan_dp(val) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: val

Value to analize. It can have any rank and dimension

Return Value logical

True if the variable is NaN. False otherwise. It will have the same rank and dimension as the input value.

private elemental function is_nan_qp(val) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=qp), intent(in) :: val

Value to analize. It can have any rank and dimension

Return Value logical

True if the variable is NaN. False otherwise. It will have the same rank and dimension as the input value.