isclose Function

public elemental function isclose(a, b, rel_tol, abs_tol)

Checks if two floating point numbers of type double are close within tolerance.

Based on python implementation at https://github.com/PythonCHB/close_pep/blob/master/is_close.py. The method='weak' option is used here.

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in) :: a
real(kind=rp), intent(in) :: b
real(kind=rp), intent(in), optional :: rel_tol

Relative tolerance, rel_tol >= 0, default 1e-10

real(kind=rp), intent(in), optional :: abs_tol

Absolute tolerance, abs_tol >= 0, default 0.0

Return Value logical