Hi, I have just worked on the “Grade Sheet” exercise in the x86-64 assembly track. It was quite enjoyable, thanks to the author.
The instructions of “Grade Sheet” say, "Each score earns a rank from 1 to 3:
- Rank 1 for a score at or below the passing threshold of
50.0. - Rank 2 for a score above that threshold but short of the maximum.
- Rank 3 for a perfect score, one that equals the maximum.
We have three mutually exclusive conditions, which lead to different ranks. This setup is nicely related to the branchless programming using the SIMD instructions described in the concept, " SIMD: Masks and Conditions". Note that the mutual exclusiveness does matter for the approach described in the concept, as it “collects” the results from SIMD registors by por at the end.
Unfortunately, one of the tests of the exercise, test_assign_ranks_perfect_overrides_threshold , has a case with maximum = 50. This maximum score value is the same as the (inclusive) failing threshold. So, the conditions for rank 1 and rank 3 are not mutually exclusive in the particular case. In addition, the case in question comes with score = 50. It is unclear which score the stduent should receive, 1 or 3.
I think that the particular test should be removed. It is confusing and inconsistent with the underlying concept lesson.
P.S. One might argue that the approach described in the concept works in the particular test. Yes, it does, but by accident, because 1 | 3 = 3. If the rank to assign to the full score were 4, the same code would assign rank 5 to the student.