Calculated questions' automatic scientific notation conversion threshold too low
Description
is depended on by
is related to
relates to
Activity
Brian J. August 29, 2017 at 11:14 AM
I created to address the above issue.
Brian J. August 28, 2017 at 10:51 AM
I spoke too soon. We actually did find a bug with this, where the upper threshold is not obeyed. The bug is just that in the determineRandomValuesForRanges() method, some doubles weren't converted to BigDecimal:
So if the upper threshold is greater than possibly stored in a double, maxVal ends up with scientific notation in it already, which in turn leads to scientific notation in randomValue object, which then gets passed to the toScientificNotation() method which looks for the occurrence of 'e' or 'E' in the string, and if so, keeps it in scientific notation. this results in numbers less than the upper threshold still being converted into scientific notation.
I'll submit a new JIRA/PR to address this issue.
Brian J. August 23, 2017 at 8:26 AM
Marking this as verified. I backported this to our customized 11.3 instance, and it works as advertised. The upper threshold is now 1e+11 and the lower threshold remains the same. Functionality and grading of the question is unchanged.
Matthew Jones July 11, 2017 at 10:53 AMEdited
I put a fix in for this that passes the local tests and probably will need some testing. The max threshold was increased, the minimum stays the same (mostly because the precision would make the minimum not matter most of the time anyway)
It should be better overall at dealing with the exponents and such, but please test! (And re-open if any comments, or mark as verified)
Tiffany Stull July 6, 2017 at 1:53 PM
I suspect that the only places it would be used would be in Calculated Questions and possibly Numeric Response. I think the input fields for these are the only ones that validate numbers.
Note: I'm filing this as a bug because it seems to me to be unexpected, bad behavior, but others may classify it more as a feature request.
As a result of changes made in --SAM-2711--, calculated questions automatically convert any number larger than 10000 to scientific notation, i.e. 1E4.
The conversion can create a really ridiculous-looking question like the following:
I understand that the feature was implemented to handle really large numbers, but I can't imagine any accountant would write $2.6E5 instead of $260000! Either the number at which the conversion occurs needs to be MUCH greater, e.g. 1E11, OR the instructor should be able to select (with a check box) to convert the variable values to scientific notation, if desired. The silent conversion makes no sense at all.
Testing Steps:
In a site with at least one student/member, create a quiz and add a Calculated Question.
Enter question text that would use relatively large numbers, e.g. the following (pardon me if the formula will actually give incorrect results - I'm not a math person! - I'd appreciate a correction if wrong!):
*Save*the question.
Publish the quiz.
Log in as student and take the quiz. Note that the question looks like this:
A couple spends approximately 13% of their annual income on food. Their combined annual income is $2.6E5. On average, the husband eats twice as much food as his wife. The wife eats approximately $___ worth of food per year.