cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
barnettda
Community Contributor

Why This Strange Quiz Points Total?

Jump to solution

Hi, everyone,

Twice now I've created a quiz in Canvas, assigned each question a point value of .15, only to have the calculated total points add many zeroes and a 1 at the end. Here's what the total looks like:

quiz-strangeness - dbarnett's library

The same thing happened on a previous quiz and I went back and checked three times that I hadn't added in an extra number somewhere. But all the questions shows .15 points each.

I've created a dozen other quizzes, each with question point totals of .15, and all is well.

Does anyone know what might be happening?

Cheerily,

Dan

Tags (1)
1 Solution

Accepted Solutions
James
Community Champion

 @barnettda ​,

You're seeing an artifact of trying to represent decimal numbers (0-9) in a binary world (0,1). Most floating point numbers don't convert exactly to binary.

However, Canvas has made attempts to keep this from happening, so I would file it as a bug report.

I'm able to repeat what you're seeing.

199515_pastedImage_1.png

If you edit the quiz, you'll see that it thinks it's worth 7.2 points.

199514_pastedImage_0.png

However, if you pay really close attention to this as the page loads in the browser, it starts of as 7.20000000000001 and then gets changed to 7.2 as the JavaScript pretties up the page.

199522_pastedImage_0.png

If you go into the gradebook, it shows up with all of the decimal places. That's a place they've definitely worked on fixing so this doesn't happen.

199516_pastedImage_2.png

The surface reason it's showing up wrong is because the quiz object says the points_possible is 7.20000000000001.

2016-08-21_13-11-34.png

The quiz page and the gradebook are just displaying what it says is possible.

The fix would be to fix it in the quiz object so and then it would be fixed everywhere else.

View solution in original post

7 Replies
James
Community Champion

 @barnettda ​,

You're seeing an artifact of trying to represent decimal numbers (0-9) in a binary world (0,1). Most floating point numbers don't convert exactly to binary.

However, Canvas has made attempts to keep this from happening, so I would file it as a bug report.

I'm able to repeat what you're seeing.

199515_pastedImage_1.png

If you edit the quiz, you'll see that it thinks it's worth 7.2 points.

199514_pastedImage_0.png

However, if you pay really close attention to this as the page loads in the browser, it starts of as 7.20000000000001 and then gets changed to 7.2 as the JavaScript pretties up the page.

199522_pastedImage_0.png

If you go into the gradebook, it shows up with all of the decimal places. That's a place they've definitely worked on fixing so this doesn't happen.

199516_pastedImage_2.png

The surface reason it's showing up wrong is because the quiz object says the points_possible is 7.20000000000001.

2016-08-21_13-11-34.png

The quiz page and the gradebook are just displaying what it says is possible.

The fix would be to fix it in the quiz object so and then it would be fixed everywhere else.

barnettda
Community Contributor

Thanks, James!

Is there something I can do to fix this? My students will lose faith in Canvas' ability to correctly calculate grades. And why does this happen only on some combinations? I've done lots of quizzes with question values of .15 and the math all works out. What's different in this instance?

You say the "fix would be to fix it in the quiz object" but I don't understand. Fix what?

Thanks for taking on my issue. Class begins Monday and you'd know I'd run into something strange! 🙂

Cheerily,

Dan

James
Community Champion

After I had posted my response, I went back and reread it and thought that perhaps I should have clarified "the fix" to indicate it wasn't your issue. The fix I mentioned is something that Canvas needs to do on their end. Most people would consider the rest to be tl;dr, but I do have a possible work-around in the last paragraph.

The issue will happen in other cases, but it's not easily predictable when it will happen. It's nothing unique to 0.15, it happens with a lot of values. Numbers like 2.32 might be 2.319999999999 or 2.3200000000001. When Canvas displays them to 2 decimal places, they look good. In fact, if you try putting in 2.325, Canvas rounds it to 2 decimal places for you. So it's not the display that's the issue, it's the internal representation, and that's where the extra digits come in. When they added up the values 48 times, that imperfect representation was compounded enough that it actually showed up.

I wrote a quick script to check things. I started with 0.15 and then added it 48 times, asking the computer to display the result after each step.

0.15

0.3

0.44999999999999996

0.6

0.75

0.9

1.05

1.2

1.3499999999999999

1.4999999999999998

1.6499999999999997

1.7999999999999996

1.9499999999999995

2.0999999999999996

2.2499999999999996

2.3999999999999995

2.5499999999999994

2.6999999999999993

2.849999999999999

2.999999999999999

3.149999999999999

3.299999999999999

3.449999999999999

3.5999999999999988

3.7499999999999987

3.8999999999999986

4.049999999999999

4.199999999999999

4.35

4.5

4.65

4.800000000000001

4.950000000000001

5.100000000000001

5.250000000000002

5.400000000000002

5.5500000000000025

5.700000000000003

5.850000000000003

6.0000000000000036

6.150000000000004

6.300000000000004

6.450000000000005

6.600000000000005

6.750000000000005

6.900000000000006

7.050000000000006

7.200000000000006

Note that this does not happen if you use numbers that can be represented exactly in binary. These include integers and fractions with a denominator that are powers of 2 like 1/2, 1/4, 1/8, 1/16, etc. Canvas will round the point value to 2 decimals, so 1/2=0.5 and 1/4=0.25 are the only two that will work within the Canvas quiz and not have the conversion issues.

The issue appears to be with the Quiz JavaScript as it's the one that is writing 7.20000000000001 to the Canvas system when you click Save. In other words, it seems like Canvas is storing what your browser tells it to store. However, I went into the page and modified the value to read 7.2 instead of 7.20000000000001 and when I saved it, the browser sent 7.2, but when Canvas reloaded, it was still the longer version of 7.20000000000001. So the Canvas back-end is recomputing the total points possible as well.

I tried using the API call to update a quiz. When I put in 7.2, the response was the 7.200000000000006 that you see in line 48 of the test run above. Canvas is rounding that to 7.20000000000001, which has one less decimal place, but is essentially the same number.

So, all of the things that I've tried will not let you get 7.2 in for the possible points.

I hypothesize that there is a logic error in Canvas' rounding. It seems (I didn't check the code) like they're rounding to 14 decimals and then removing any 0's from the end. That seems reasonable, but the precision builds and after a while (45 questions in this case), it's enough to cause a problem.

I delete 4 questions, so that there are 44 questions, then it shows 6.6 instead of 6.600000000000005. If you look at the sequence of numbers, you'll see that 6.600000000000005 is actually less than 6.600000000000005 and would round down to be 6.60000000000000 and then extra 0's are removed to get 6.6.

If I only delete 3 questions, so there are 45, then 6.750000000000005 rounds to 6.75000000000001 and that is what is shown, not 6.75.

If I delete 2 questions, so that there are 46, then 6.900000000000006 round up to 6.90000000000001 and that is what is shown, not 6.9.

All that reconfirms that it is an issue that Canvas needs to fix, not anything that you can do. If you're going to only allow 2 decimal places in a point value, then you should round that as you calculate, rather than waiting until the end after you've added everything to round. Normally, we like to hold off on rounding until the end, but in this case, it's causing an issue when they don't.  You may be able to specify point values beyond the hundredth with the API, and if you did round as you went, then things like 1/3+1/3+1/3=1, but when rounding you get 0.33+0.33+0.33=0.99 instead of 1. A better solution would be to use a larger tolerance (instead of 14 decimals, only check to 2) at the end of the calculations. Or, if you're not willing to go to 14, then check 13. It's still going to run into issues if there are enough questions (450 instead of 45). There are lots of possible solutions, but this is ugly and you're right -- it doesn't instill confidence in the students.

I did discover one trick in my playing around. It was actually the first thing that I tried before I got it to duplicate your issue, but I went back and retried and confirmed that it works. If you don't care about the order of the questions, you can move them into a question group. When I create a question group with 48 questions worth 0.15 points each, then it comes out being worth 7.2 points, not 7.20000000000001. That's a hack, and shouldn't have to be done, but it seems to fix the problem until Canvas can get it fixed on their end.

barnettda
Community Contributor

Hi, James,

This is extraordinary. Wow!

I thank you, the community thanks you, for letting us know what's going on behind the scenes. Your work is appreciated!

Cheerily,

Dan

dkallemeyn
Community Member

The developers need to go back to the drawing board and fix things so that an instructor can at least assign each question a integer value per question, "1" would be simplest, because 1 is also 1 in binary.  My quizes that I import from a test-bank generator are all coming out with 100 points for each question. Wow! Talk about "Grade Inflation".

Anyway, I've switched from Blackboard this semester and am getting the feeling that perhaps Canvas is not yet ready for prime-time viewing.

James
Community Champion

Did you import the test-bank questions as a question bank? Point values in a question bank are largely irrelevant. When you add them to a quiz, you tell it there how much to assign for each question. If I tell it questions in the bank are 100 points each, it's ignored when I tell them they're 5 points each for the quiz.

dkallemeyn
Community Member

Well, after searching and searching (three times), I found where the

imported test banks are hidden (three different times) and finally figured

out how to edit more than just the bank title and actually change the

points from 100 for each question to 1.

As a database administrator and developer at my day-job, I rather expect

easily visible (and perhaps multiple) ways to get to commonly used modules

in software programs. I'm guessing that perhaps a small percentage of

instructors like to import test banks from text publishers (and edit the

questions to "improve" them) and I think it should be a bit easier to find

"Edit Test Banks" in Canvas (or at lease in the search box of Canvas Help).

No matter, I've found it enough times that I actually remember how to get

to the Test Bank Editor and can modify the points for each question. But

I'm wondering if it would be faster just to print out the quizzes and grade

them by hand because I have to import the bank and then edit the bank

before I can create a quiz and set all the options, whereas I could just

print the quiz directly from the test bank editor and then pass out the

papers.

But don't mind me, I'm just a cranky old adjunct computer instructor who

has current aerospace industry experience.

Just keep my suggestion "Marked as helpful" and fix the bigger problems

first.

Dennis Kallemeyn

On Sun, Aug 28, 2016 at 10:18 AM, stefanievsanders@gmail.com <