significant figures in answer display

significant figures in answer display

by Dave Eckstrom -
Number of replies: 11

When I create a simple calculated quiz question, I always specify the number of significant figures that should be shown in the correct answer, but it doesn't seem to have any effect.  When I preview the question, Moodle always seems to spit out about 10 sig. figs., no matter how many I have specified.  Can anyone tell me what I'm doing wrong? 

Average of ratings: -
In reply to Dave Eckstrom

Re: significant figures in answer display

by Pierre Pichet -

You are not doing anything wrong.

Here I set 3 significant figures and I got 5.30 which is OK

Set 10  {x}
5.3 = 5.30
Correct answer : 5.30 inside limits of true value {x}
Min: 5.2469999999999 --- Max: 5.3530000000001
The minimum and maximum range of the numerical value (spit out about 10 sig. figs) are the range that will be used to test if the numerical student response is OK.
This range is always a little lesser and greater than the exact tolerance range that the teacher set because PHP as a limited precision that can vary from one installation to the other.
So this precision limit (here 0.0000000000001) in this case is added or or substracted to the tolerance that was set ( here 5.247 to 5.353).
Doing this we can assure that the student has not a bad grade because of the rounding errors of the PHP precision of the Moodle installation used.
Pierre



In reply to Pierre Pichet

Re: significant figures in answer display

by Alan Arnold -

I'm struggling with this too I'm afraid Pierre. In 2.1.2, the Correct answer is shown to students with a large number of digits, despite the fact that the question has been set up to show the correct answer to 3 decimals, as this screenshot shows:

Attachment CalcQuizFeedbackTooManyDigits.png
In reply to Alan Arnold

Re: significant figures in answer display

by Pierre Pichet -

I try on Moodle demo site (http://demo.moodle.net) and I got the set format

 
So migrate to 2,2 and your problems should be solved wink
 
Pierre
In reply to Pierre Pichet

Re: significant figures in answer display

by Alan Arnold -

I get different behaviour on demo.moodle.org Pierre. As this screenshot shows, the "Correct" answer is shown to too many digits in the feedback (set to 3 dec places in this example) 

Calculated Question Correct answer shows too many digits

In reply to Alan Arnold

Re: significant figures in answer display

by Pierre Pichet -

What are the formula and the settings ( tolerance etc.) of the answer?

How the answer value is displayed ( including the min max info) in the third question editing page (edit_dataset_form) ?

Pierre 

In reply to Pierre Pichet

Re: significant figures in answer display

by Alan Arnold -

formula is {b}*{c}*{c}/{d}

Tolerance is default 0.01. Correct answer to show 3 decimals. Variables b, c, d all between 1 and 10 to 2 dec places, uniform distribution. The quiz is set for immediate feedback, to show the correct answer. 

When you *set up* the question, the correct answer shows to 3 dec places, as expected, and is inside the calculated range, as you can see below BUT when you preview or attempt the quiz, this is where the Correct answer shows too many digits shown in the previous screenshot.

As far as I can tell, both the Calculated and Calculated Simple question types have this behaviour on demo.moodle.org. The same behaviour occurs on the latest nightly build of 2.1.4 but Calculated Multichoice displays the corect number of digits there (I haven't had a chance to test CMC on demo.moodle.org) 

Calc Question type shows too many digits in correct answer

In reply to Alan Arnold

Re: significant figures in answer display

by Pierre Pichet -

Thanks for the clear illustration.

This allows me to pinpoint more precisely the problem.

I can reproduce.

I will set a tracker issue if necessary.

More news later

Pierre

 

In reply to Pierre Pichet

Re: significant figures in answer display

by Pierre Pichet -

Tim,

The problem is that the calculated questiontypes use the numerical renderer.php correct response function which does not take in account the significant figures defined by the calculated.

So I will set a proper tracker issue if not already done.

Pierre

P.S. This follows from the

class qtype_calculated_renderer extends qtype_numerical_renderer {
} which itself

class qtype_numerical_renderer extends qtype_renderer {

and that the correct handling of significant figures is set in

class qtype_varnumeric_renderer_base extends qtype_renderer {

I honestly think that Tim which build these renderer classes could better than me find the most elegant solution. wink

 

In reply to Pierre Pichet

Re: significant figures in answer display

by Pierre Pichet -

"and that the correct handling of significant figures is set in

class qtype_varnumeric_renderer_base extends qtype_renderer { "

Oups , I just forgot that I have installed this new qtype.

So the solution is more simple.

It could be done by adding a specific qtype_calculated_renderer function in qtype_calculated_renderer .

And I can handle this wink.

Pierre

 

In reply to Pierre Pichet

Re: significant figures in answer display

by Alan Arnold -

That's great news Pierre - many thanks for your prompte attention to this.  If you let us know the tracker issue number here, I'll keep an eye out for it and ask our Moodle partner to implement the fix as an emergency update as soon as possible. 

My analytical chemist colleague who has weekly quizzes for her class of 500 students will be greatly relieved smile  

- Alan