FORCES
FORtran lib for Comp. Env. Sys.
|
Comparison of real values. More...
Public Member Functions | |
logical elemental pure function | is_close_sp (a, b, rtol, atol, equal_nan) |
logical elemental pure function | is_close_dp (a, b, rtol, atol, equal_nan) |
Comparison of real values.
Compares two reals if they are numerically equal or not, with option for precision, i.e. equal:
\[ |a-b| < \mathrm{max} \{ \epsilon_\mathrm{rel} \mathrm{max} \{ |a|,|b| \}, \epsilon_\mathrm{abs} \} \]
Example
Returns ´.false.´ in 5th element of isequal
Returns ´.true.´ in all elements of isequal
Returns ´.false.´ in 6th element of isequal
Returns ´.true.´ in all elements of isequal
[in] | real(sp/dp) :: a | First number to compare |
[in] | real(sp/dp) :: b | Second number to compare |
[in] | real(sp/dp), optional :: rtol | Relative tolerance, will scale with a (DEFAULT : 1.0E-5). |
[in] | real(sp/dp), optional :: atol | Absolute tolerance (DEFAULT : 1.0E-8). |
[in] | logical, optional :: equal_nan | If \(.true.\), NaN values will between a and b are considered equal. |
real(sp/dp) :: is_close | \( a == b \) logically true or false |
Definition at line 225 of file mo_utils.F90.
logical elemental pure function mo_utils::is_close::is_close_dp | ( | real(dp), intent(in) | a, |
real(dp), intent(in) | b, | ||
real(dp), intent(in), optional | rtol, | ||
real(dp), intent(in), optional | atol, | ||
logical, intent(in), optional | equal_nan | ||
) |
Definition at line 936 of file mo_utils.F90.
logical elemental pure function mo_utils::is_close::is_close_sp | ( | real(sp), intent(in) | a, |
real(sp), intent(in) | b, | ||
real(sp), intent(in), optional | rtol, | ||
real(sp), intent(in), optional | atol, | ||
logical, intent(in), optional | equal_nan | ||
) |
Definition at line 966 of file mo_utils.F90.