Numerical Precision of Moodle Quiz answers

Numerical Precision of Moodle Quiz answers

by Richard Mott -
Number of replies: 7

I have set a quiz in Moodle with numerical answers. Some of these answers are very small eg 2e-16. Unfortunately although I can enter these numbers into the Moodle edit question page, it later on rounds them to 0. This makes it very difficult to automate marking of the quiz. Is there a way round this?


I am not sure which version of Moodle I am using, it's the one at UCL 


Thanks


Richard Mott

Average of ratings: -
In reply to Richard Mott

Re: Numerical Precision of Moodle Quiz answers

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Take a look at this example (Very small range values): https://moodleformulas.org/course/view.php?id=22&section=27#id201910201202
In reply to Dominique Bauer

Re: Numerical Precision of Moodle Quiz answers

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Richard and Tim,

The following simple quiz "Mass of an electron" seems to work perfectly with the Formulas question (but not with the Numerical question).

ForumQuiz_20191108_2029.png

Formulas question type ↗

In reply to Dominique Bauer

Re: Numerical Precision of Moodle Quiz answers

by Richard Mott -

Dear Dominique and Tim


Thanks

Does this means that, since my students have taken the quiz, I can’t change the behaviour of a numerical question and will have to hand-make all their answers?

Is there any likelihood that the numerical question code will be modified in future so that it can handle very small numbers correctly? This seems to be a common requirement.

If so, how do I put in a formal request?

Best Wishes

Richard

In reply to Richard Mott

Re: Numerical Precision of Moodle Quiz answers

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There is already a 'formal request'. I gave the link to the but report in the database below.

It is obviously a bug, but it will get fixed one day, but hard to guess when. It will get fixed when someone fixes it.
In reply to Richard Mott

Re: Numerical Precision of Moodle Quiz answers

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

In the meantime, I suggest you take a look at the Formulas question type ↗. It is quite easy to use and seems to handle small values correctly.

Average of ratings: Useful (2)
In reply to Dominique Bauer

Re: Numerical Precision of Moodle Quiz answers

by Richard Mott -

Thanks

I'll bear that in mind for the next quiz. for the current one, it looks like I will have to manually mark the answers, as the students have taken the quiz.

Richard

In reply to Richard Mott

Re: Numerical Precision of Moodle Quiz answers

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I remembered fixing a bug a bit like this, but it turns out that it was in a custom question type (https://github.com/moodleou/moodle-qtype_pmatch/commit/b5b46fa55ce94d457cdb939dedcaf35d098e5250)

Thinking too hard about numerical precision with computer floating point numbers is a good way to make your head explode. I see that MDL-52893 was closed won't fix, but MDL-60483 is still open, and I think it is a valid bug report.