Tests two real numberes for inequality using a tolerance if provided by the user, or selecting a tolerance automatically otherwise.
n = ne(f1, f2, eps)
Where:
f1
: First real number to compare for inequality.f2
: Second real to compare for inequality.eps
: User selected tolerance for the comparison. If not provided it
will be selected automatically.It returns True both numbers are not equal according to the selected tolerance and False otherwise
The following program tests if two real numbers are not equal:
PROGRAM neExample
USE FU_Numbers, ONLY: ne
IMPLICIT NONE
WRITE(*,*) ne(5., 5.00001, 0.000000001)
WRITE(*,*) ne(5., 5.00001, 0.001)
WRITE(*,*) ne(5., 5.00001)
END PROGRAM neExample
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=sp), | intent(in) | :: | x1 |
First real value to compare for inequality. |
||
real(kind=sp), | intent(in) | :: | x2 |
Second real value to compare for inequality. |
||
real(kind=sp), | intent(in), | optional | :: | eps |
User selected tolerance for the comparison. If not provided it will be selected automatically. |
True if the numbers are not equal according to the selected tolerance. False otherwise.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | x1 |
First real value to compare for inequality. |
||
real(kind=dp), | intent(in) | :: | x2 |
Second real value to compare for inequality. |
||
real(kind=dp), | intent(in), | optional | :: | eps |
User selected tolerance for the comparison. If not provided it will be selected automatically. |
True if the numbers are not equal according to the selected tolerance. False otherwise.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=qp), | intent(in) | :: | x1 |
First real value to compare for inequality. |
||
real(kind=qp), | intent(in) | :: | x2 |
Second real value to compare for inequality. |
||
real(kind=qp), | intent(in), | optional | :: | eps |
User selected tolerance for the comparison. If not provided it will be selected automatically. |
True if the numbers are not equal according to the selected tolerance. False otherwise.