The instructions for this exercise conclude with the direction:
Make testDouble2() display the result of comparing Double.MAX_VALUE and Double.MAX_VALUE + 1.
but the verb "comparing" seems ambiguous, as there are multiple relational operators that "compare" values. I was not at all clear whether the output should be some indication of their relationship (e.g. "less"/"greater"/"equal"), should be the boolean result of a specific relational test, should be e.g. the maximum of the two, etc.
Based on my experience with floating-point computation, I guessed blindly that this might be looking for the (non-intuitive for beginners) fact that 1 is below the threshold of significance compared to Double.MAX_VALUE and therefore adding 1 to Double.MAX_VALUE yields the same value. But that was drawing on experience I wouldn't expect of a beginner. So, I actually felt that I succeeded by lucky guess because the expectation wasn't clear to me.
I'd recommend adding the phrase "...for equality" or something even more explanatory at the end of that direction.
The instructions for this exercise conclude with the direction:
but the verb "comparing" seems ambiguous, as there are multiple relational operators that "compare" values. I was not at all clear whether the output should be some indication of their relationship (e.g. "less"/"greater"/"equal"), should be the boolean result of a specific relational test, should be e.g. the maximum of the two, etc.
Based on my experience with floating-point computation, I guessed blindly that this might be looking for the (non-intuitive for beginners) fact that 1 is below the threshold of significance compared to
Double.MAX_VALUE
and therefore adding 1 toDouble.MAX_VALUE
yields the same value. But that was drawing on experience I wouldn't expect of a beginner. So, I actually felt that I succeeded by lucky guess because the expectation wasn't clear to me.I'd recommend adding the phrase "...for equality" or something even more explanatory at the end of that direction.