Space Age’s test suite compares an expected floating point value to a value returned from the student’s code. That forces a student to round their values, but it feels a bit wrong to strictly compare two floating point values like this. Jest has a .toBeCloseTo(number, numOfDigits) method that can compare a student’s result within an accepted amount of tolerance. The student can still round if they wish, but currently passing solutions shouldn’t break with this change.
On the one hand, I think rounding is required by most the tracks and is implied by the canonical data. On the other hand, there’s nothing in the docs or canonical data which says rounding is required.
I’m not sure if rounding is specifically intended to be part of the exercise/challenge here or something that just so happened to show up.
On further reflection, one thing that sometimes trips up students in this exercise is rounding prematurely (relying on the rounded earth age to compute other ages). We could make this exercise simpler by removing the rounding. But I think that gotchas and making sure precision isn’t dropped incorrectly as early stages is actually an interesting and important part here and worth keeping. If rounding is dropped, that element goes away.
Agree with this, but think that if we’re still comparing to 2DP it’s probably going to be ok.
Are you suggesting this rather than the rounding to ints (to be clear?)
If the exercise tests for close-values then, if i understand correctly, the student doesn’t need to perform any rounding at any point and this all goes away.
I believe that Ruby still has a delta check, rather than relying on rounding. The rounding and forced loss of precision is something that ends up being a talking point.
I hope that no one uses it for space travel, but arbitrary precision mathematics can be a useful exercise.