Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A comparison of floating point numbers x and y in practical code is typically gi

ID: 3885301 • Letter: A

Question

A comparison of floating point numbers x and y in practical code is typically given by |x y| < E, for some user-chosen value of E > 0, to replace testing for exact equality by “Does x = y”?. The indicated comparison is not an equivalence relation between x and y.

1Ai. Which needed property fails to hold? (2 pts)

1Aii. Give a specific example of this failure to be an equivalence relation. (3 pts)

A comparison of floating point numbers r and y in practical code is typically given by for some user-chosen value ofe > 0, to replace testing for exact equality by "Does x = y. The indicated comparison is not an equivalence relation between r and y. 1Ai. Which needed property fails to hold? (2 pts) 1Aii. Give a specific example of this failure to be an equivalence relation. (3 pts)

Explanation / Answer

The equality relation that x and y are equal if |x - y| < E is not an equivalence relation.

Equivalence relation means it has to be refelexive, symmetric and transitive.

The transitive propert does not hold here.

If we take x = 2.5 y = 2.6 and z = 2.7 and E = 0.11

so x and y are equal as per the relation becuase the difference between them is 0.1 < E
so y and z are equal as per the relation becuase the difference between them is 0.1 < E

but this does not mean that x = z because in current case x is not equal to z. The difference between x and z is 0.2 > E. Transitivity fails and that is why this relation is not equivalence realtion.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote