Test if two real arrays are exactly equal. Arrays must be of the same length and have the same values in the same positions. Uses epsilon value to account for floating point error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | res | Real value result being tested. |
|
real(kind=wp), | intent(in), | dimension(:) | :: | tgt | Target real value to compare result to. |
function realArrEq(res, tgt) result(comp)
!! Test if two real arrays are _exactly_ equal. Arrays must be of the
!! same length and have the same values in the same positions. Uses
!! epsilon value to account for floating point error.
real(kind=wp), dimension(:), intent(in) :: res
!! Real value result being tested.
real(kind=wp), dimension(:), intent(in) :: tgt
!! Target real value to compare result to.
logical :: comp
if (size(res) /= size(tgt)) then
comp = .false.
return
end if
comp = all(abs(res-tgt) < eps)
end function realArrEq