realEq Function

public function realEq(res, tgt) result(comp)

Test if two real values are equal. Uses an epsilon value to account for floating point error.

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in) :: res

Real value result being tested.

real(kind=wp), intent(in) :: tgt

Target real value to compare result to.

Return Value logical

Return whether both values are equal.


Contents

Source Code


Source Code

function realEq(res, tgt) result(comp)
    !! Test if two real values are equal. Uses an epsilon value to account
    !! for floating point error.

    real(kind=wp), intent(in) :: res
        !! Real value result being tested. 
    real(kind=wp), intent(in) :: tgt
        !! Target real value to compare result to.
    logical :: comp
        !! Return whether both values are equal.

    comp = abs(res-tgt) < eps
end function realEq