Skip to content
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

Floating point error accumulates in MCQ part and gapfills #585

christianp opened this issue Nov 13, 2018 · 1 comment


None yet
1 participant
Copy link

commented Nov 13, 2018

A 'match choices with answers' part with 6 marks available will only ever get the 'partially correct' feedback message, because the floating point representation of 1/6 is slightly lower than 1/6.

Should credit be considered as a rational number? I can't see a reason for irrational amounts of credit. We could run Numbas.math.rationalApproximation on amounts of credit, and store the credit as a rational number. This would mean we can still use floats to specify amounts of credit to award, but don't lose accuracy.

christianp added a commit that referenced this issue Nov 13, 2018

round off credit when deciding between 'correct' and 'partial'
quick fix to #585: round off the credit when deciding if it's equal to 1.

This doesn't really fix the problem: the total is still a bit low, so
if there are lots of instances of this problem in an exam, a big error could
accumulate and affect the total score.

@christianp christianp changed the title Floating point error accumulates in MCQ part Floating point error accumulates in MCQ part and gapfills Nov 29, 2018


This comment has been minimized.

Copy link
Member Author

commented Nov 29, 2018

This applies to gapfills, too: if there are 6 gaps, each worth 1 mark, the credit from each one will contribute 1/6 of the credit available for the parent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.