-
-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rational Numbers and Division by Zero #1681
Comments
Hi and welcome! 👋 The behaviour of div by 0 in rational numbers is inconsistent across native language implementations of them. Python's fraction module throws an error, Julia's rational number type does not. |
After reading #1856, should this be closed? |
I think #1856 still allows for test cases to cover this as two mutually exclusive cases, one where Note that #1736 also touches on this. |
Are you suggesting to add two test cases, one of which should only ever be implemented? |
Yes |
I'm not sure I really like that idea to be honest. |
Why not? |
We've never done that before and I find it unintuitive for implementers. |
I don't think it's that much different than a scenario. You go through the cases one by one as you're already meant to do and then decide which one to implement. Here they'd both be right below each other and have a comment pointing out the exclusivity. I don't see how that is less intuitive than deciding whether to implement any other test case or figuring out which reimplemented case to use. |
Well, let's just ask others what they think. CC @exercism/reviewers |
If I understand correctly, the core desire here is: For this input, the implementing track may make its own decision as to what they want the output to be. Remember back in the days where I tried to do this for all-your-base by codifying the choice in the
Not going to require anyone to do it this way since this stuff is all in the past and maybe we have some new understandings of ways to do things that mean a different way is better. I understand that it's possible some may object to doing it this way, as making a default choice would seem to privilege it over the alternative, the objection being that tracks may just blithely go with the default instead of making their own reasoned decision. If you want to avoid that, maybe you could try doing something like #1002 then... "expected": {
"track_specific_decision": [
"infinity",
{"error": "division by zero"},
]
} |
Thanks for summarising and linking existing discussion :)
I think the key difference is that nowadays, tracks must1 decide whether to include each case individually anyway. Therefore there is no default in the same sense as it existed back then. Footnotes |
Hi. First time here.
Should the Rational Numbers test suite check that an exception is raised for division by zero?
Normally, I would say that it is a detail that doesn't add to the concept, but Rational Numbers is a very mathy exercise.
(I saw this on the Python track. Not sure if the tests are the same on the other tracks)
The text was updated successfully, but these errors were encountered: