Test if two real values are equal. Uses an epsilon value to account for floating point error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 whether both values are equal.
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