Feature/sig fig#15
Conversation
…lidation and mutual exclusivity checks
…ance handling into dedicated helper functions
| } | ||
| ``` | ||
|
|
||
| ### `atol` |
peterbjohnson
left a comment
There was a problem hiding this comment.
Major comment:
- I think we need to sit with Phil and discuss what we mean by sig fig and what the requirements are here. I've made a more detailed note inline in the code.
Minor comment:
- can update all docs and code to the new parameter names (maybe do a sweep) for atol/rtol?
|
|
||
| rounded_answer = _round_to_sig_figs(answer, sig_figs) | ||
| rounded_response = _round_to_sig_figs(response, sig_figs) | ||
| is_correct = abs(rounded_response - rounded_answer) <= spacing(abs(rounded_answer)) |
There was a problem hiding this comment.
I think we need to discuss with Phil what we mean by sig figs.
Example:
answer = 0.123
response = 0.1231
Is the response correct to 3 sig fig? Is this a scientific question of expressing a number to 3 sig fig? If so then no, the response is not correct. It should have been rounded to 0.123. If we're asking for the two numbers to be similar after rounding to 3 s.f. that's a different criterion?
Similarly 0.1230 could be interpreted as equal to 0.123, or not equal because it implies a different level of precision. (e.g. https://ccnmtl.columbia.edu/projects/mmt/frontiers/web/chapter_5/6665.html)
I suspect that we need two types of sig fig checking? The computational type and the scientific type? The latter would need to operate on the string before it is converted to a float or integer as a prelude.
I also wonder if we should incorporate feedback when there is a level of known equality (this point applies to the wider isSimilar), e.g. 'correct within the allowed tolerance'.
There was a problem hiding this comment.
Thanks for the feedback, I am happy to discuss with Phil further. However, I think the link you gave provides the detail that I missed in my first implementation. Currently, the implementation doesn't support trailing 0s for decimal numbers as the conversion will truncate them.
I think adding feedback throughout would also be beneficial. I'll make the edits.
Requires #14
Problem
IsSimilar should also support significant figures and tolerances.
Changes