How to check repeating decimals?

Hello All,
I want to check students’ answers when the answers include repeating decimals. How can I do it?
For example: the answer is 0.8888…

Hi, I’m not aware of a good way to handle students typing … at the end of an answer, but here is one workaround.

It works because Desmos can interpret … as part of a list. If a student types in 0.8888…, the CL adds extra characters around what the student types to make it [0.8888…1][1], which is just 0.8888
I wouldn’t really recommend using this in practice; I’d just tell students in the instructions to round their answer. It happens to work if students type three dots or four dots at the end of a number, but it breaks if a student types five or more dots. Hopefully someone else has a better solution!

For now, it is a satisfying solution, thank you very much

You might just compare the student answer to 0.8888 and 0.8889. In a math input, I would do the following CL:

 this.numericValue
 correct: when x>=0.8888 and x<0.8889 true otherwise false
 suffix: when isUndefined(x) "" when (x>=0.8888 and x<0.8889) "✅" otherwise "❌"

If a student types 0.8888888888 it is correcct. If a student types 0.8888889, it is correct. You might put a note that says something like, “If you answer is a repeating decimal, give your answer to at least the ten-thousandths place value.”

It’s a good attempt but there’s a lot of issues with this sort of checking.
Richard touched on one, but there are probably too many things to use reliably.

For example this is marked as correct too: .88888888…0

And this is marked correct: .888…
But this isn’t: .888…

I’m curious - what’s the difference between the “this is marked correct” and “this isn’t”? I can’t decide if I’m missing something obvious or if the markdown here made the difference invisible :sweat_smile:

I agree - lots of issues with what I proposed. It “fixes” the original problem of numericValue being unable to evaluate when a student types 0.888… but introduces many new issues. Thanks for keeping me honest.

Desmos strips away the trailing decimals on-post here it would ssem. Just try adding one extra decimal and see what happens.

I like solutions like this, but I also try to break them to see what Desmos will do. Keep hacking.

1 Like

for 1.83838383… the code accepts 1.83888888 or 1.833333333 :frowning:

how can I fix it?

Looking at the current correctness check, I’m realizing that it was missing absolute value bars around the difference between the student input and desired answer. It should have looked more like

correct =
  (numericValue(`\left|\frac{8}{9} - ${value}\right|`) < 0.001)
  and not(isBlank(this.latex)) #not necessary in this case

To differentiate between 1.3888 and 1.38333 and 1.38383, you would need to replace 0.001 with a smaller number, like 0.00001.

However, the code still doesn’t know which digits are repeating. As folks pointed out above, this may not be a good solution for your problem :confused: