Suppose I have two variables, aand beither both in a type floator both in a type doublethat contain some values. Are the following statements always true? I mean, does the existence of numerical errors change the conclusions?
a> b is true if and only if a <= b is false
a <b is true if and only if a> = b is false
a> = b is necessarily true if a == b is true
a <= b is necessarily true if a == b is true
For the third and fourth, I mean, for example, "a == b is true" always gives you "a> = b is true"?
EDIT:
Suppose that neither a, nor bis NaN or Inf.
EDIT 2:
After reading the IEEE 754 standard in 1985, I found the following.
First of all, he said the following
Comparisons are accurate and never overflowing or overflowing.
I understand that when comparing, there is no quantitative error, numbers are compared as-is. Since addition and subtraction, such as a - b, require additional efforts to determine what a numerical error is, I believe that the above quote indicates that comparisons such as a > bare not performed by evaluating whether it is a - b > 0true or not. Please let me know if I am wrong.
Secondly, he listed four canonical relations that are mutually exclusive.
: , , . , - NaN. NaN , .
4 , " > " " > =" . :
a >= b , a < b - false
a <= b , a > b
a >= b a <= b , a == b
, . , , . , a > b, , b < a . , a <= b is true b < a is false. , OP, :
a < b , b > a
a <= b , b >= a
.
3:
, @Mark Ransom, , , . -, - , , , .
4:
IEEE 754 2008 , . , undefined.
( , NaN Inf).