warning_helpers Module

Small functions for making semantically-correct code that doesn't raise compiler warnings (or at least, fewer). The main downside of this is requiring a function call, which can destroy vectorisation of loops.



Contents


Interfaces

public interface exactly_equal

Are two numbers exactly equal to each other

  • private elemental function exactly_equal_r32(a, b)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: a
    real(kind=real32), intent(in) :: b

    Return Value logical

  • private elemental function exactly_equal_r64(a, b)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: a
    real(kind=real64), intent(in) :: b

    Return Value logical

  • private elemental function exactly_equal_r128(a, b)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: a
    real(kind=real128), intent(in) :: b

    Return Value logical

public interface not_exactly_equal

Are two numbers not exactly equal to each other

  • private elemental function not_exactly_equal_r32(a, b)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: a
    real(kind=real32), intent(in) :: b

    Return Value logical

  • private elemental function not_exactly_equal_r64(a, b)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: a
    real(kind=real64), intent(in) :: b

    Return Value logical

  • private elemental function not_exactly_equal_r128(a, b)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: a
    real(kind=real128), intent(in) :: b

    Return Value logical

public interface is_zero

Is the argument exactly equal to zero

  • private elemental function is_zero_r32(scalar)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: scalar

    Return Value logical

  • private elemental function is_zero_r64(scalar)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: scalar

    Return Value logical

  • private elemental function is_zero_r128(scalar)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: scalar

    Return Value logical

public interface is_not_zero

Is the argument not exactly zero

  • private elemental function is_not_zero_r32(scalar)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: scalar

    Return Value logical

  • private elemental function is_not_zero_r64(scalar)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: scalar

    Return Value logical

  • private elemental function is_not_zero_r128(scalar)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: scalar

    Return Value logical

public interface almost_equal

Are two numbers almost equal within some tolerance

  • private elemental function almost_equal_r32(a, b, rtol, atol)

    Are two numbers almost equal

    Uses the same predicate as numpy's isclose:

    abs(a - b) <= (atol + rtol * abs(b))
    

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: a
    real(kind=real32), intent(in) :: b
    real(kind=real32), intent(in), optional :: rtol
    real(kind=real32), intent(in), optional :: atol

    Return Value logical

  • private elemental function almost_equal_r64(a, b, rtol, atol)

    Are two numbers almost equal

    Uses the same predicate as numpy's isclose:

    abs(a - b) <= (atol + rtol * abs(b))
    

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: a
    real(kind=real64), intent(in) :: b
    real(kind=real64), intent(in), optional :: rtol
    real(kind=real64), intent(in), optional :: atol

    Return Value logical

  • private elemental function almost_equal_r128(a, b, rtol, atol)

    Are two numbers almost equal

    Uses the same predicate as numpy's isclose:

    abs(a - b) <= (atol + rtol * abs(b))
    

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: a
    real(kind=real128), intent(in) :: b
    real(kind=real128), intent(in), optional :: rtol
    real(kind=real128), intent(in), optional :: atol

    Return Value logical

private interface almost_zero

Is the argument almost zero

  • private elemental function almost_zero_r32(scalar, rtol, atol)

    Is a scalar almost zero

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: scalar
    real(kind=real32), intent(in), optional :: rtol
    real(kind=real32), intent(in), optional :: atol

    Return Value logical

  • private elemental function almost_zero_r64(scalar, rtol, atol)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: scalar
    real(kind=real64), intent(in), optional :: rtol
    real(kind=real64), intent(in), optional :: atol

    Return Value logical

  • private elemental function almost_zero_r128(scalar, rtol, atol)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real128), intent(in) :: scalar
    real(kind=real128), intent(in), optional :: rtol
    real(kind=real128), intent(in), optional :: atol

    Return Value logical

public interface complex_sq_mod

Returns , the square modulus of a complex number

  • private elemental function complex_sq_mod_r32(scalar)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real32), intent(in) :: scalar

    Return Value real(kind=real32)

  • private elemental function complex_sq_mod_r64(scalar)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real64), intent(in) :: scalar

    Return Value real(kind=real64)

  • private elemental function complex_sq_mod_r128(scalar)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=real128), intent(in) :: scalar

    Return Value real(kind=real128)


Functions

private elemental function exactly_equal_r32(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: a
real(kind=real32), intent(in) :: b

Return Value logical

private elemental function exactly_equal_r64(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a
real(kind=real64), intent(in) :: b

Return Value logical

private elemental function exactly_equal_r128(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: a
real(kind=real128), intent(in) :: b

Return Value logical

private elemental function not_exactly_equal_r32(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: a
real(kind=real32), intent(in) :: b

Return Value logical

private elemental function not_exactly_equal_r64(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a
real(kind=real64), intent(in) :: b

Return Value logical

private elemental function not_exactly_equal_r128(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: a
real(kind=real128), intent(in) :: b

Return Value logical

private elemental function is_zero_r32(scalar)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: scalar

Return Value logical

private elemental function is_zero_r64(scalar)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: scalar

Return Value logical

private elemental function is_zero_r128(scalar)

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: scalar

Return Value logical

private elemental function is_not_zero_r32(scalar)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: scalar

Return Value logical

private elemental function is_not_zero_r64(scalar)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: scalar

Return Value logical

private elemental function is_not_zero_r128(scalar)

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: scalar

Return Value logical

private elemental function almost_equal_r32(a, b, rtol, atol)

Are two numbers almost equal

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: a
real(kind=real32), intent(in) :: b
real(kind=real32), intent(in), optional :: rtol
real(kind=real32), intent(in), optional :: atol

Return Value logical

private elemental function almost_equal_r64(a, b, rtol, atol)

Are two numbers almost equal

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a
real(kind=real64), intent(in) :: b
real(kind=real64), intent(in), optional :: rtol
real(kind=real64), intent(in), optional :: atol

Return Value logical

private elemental function almost_equal_r128(a, b, rtol, atol)

Are two numbers almost equal

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: a
real(kind=real128), intent(in) :: b
real(kind=real128), intent(in), optional :: rtol
real(kind=real128), intent(in), optional :: atol

Return Value logical

private elemental function almost_zero_r32(scalar, rtol, atol)

Is a scalar almost zero

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: scalar
real(kind=real32), intent(in), optional :: rtol
real(kind=real32), intent(in), optional :: atol

Return Value logical

private elemental function almost_zero_r64(scalar, rtol, atol)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: scalar
real(kind=real64), intent(in), optional :: rtol
real(kind=real64), intent(in), optional :: atol

Return Value logical

private elemental function almost_zero_r128(scalar, rtol, atol)

Arguments

Type IntentOptional Attributes Name
real(kind=real128), intent(in) :: scalar
real(kind=real128), intent(in), optional :: rtol
real(kind=real128), intent(in), optional :: atol

Return Value logical

private elemental function complex_sq_mod_r32(scalar)

Arguments

Type IntentOptional Attributes Name
complex(kind=real32), intent(in) :: scalar

Return Value real(kind=real32)

private elemental function complex_sq_mod_r64(scalar)

Arguments

Type IntentOptional Attributes Name
complex(kind=real64), intent(in) :: scalar

Return Value real(kind=real64)

private elemental function complex_sq_mod_r128(scalar)

Arguments

Type IntentOptional Attributes Name
complex(kind=real128), intent(in) :: scalar

Return Value real(kind=real128)