# Checking correctness of fraction answer

I want the solution from students to read -33/4, but it doesn’t like my script \frac{33}{4}. It works when I set correct answer to -8.25. How can I make it mark either as correct?

If you type correct: input.numericValue=-8.25 (where input is the name of the component) into the input component, both -8.75 and -33/4 would be marked correct, as well as any other expression that would equal -8.25.

1 Like

Hi, are you able to help: What if the answer is a recurring decimal? How do I get the input rounded to 2 or three decimal places and the evaluate on the rounded input?

A simple way would be to build in a tolerance range. This would be for 1/3. You could use countNumberUsage to make sure 1 and 3 are submitted too.

correct: input.numericValue>0.33 and input.numericValue<0.34

1 Like

Thanks so much! I appreciate your input!!

You can also just do

correct: input.numericValue=numericValue("1/3")

Since Desmos will round both to the same number of places.

I wouldn’t rely on that. There are some cases where we’ve found the numeric values to be slightly different. Err on the side of caution here and either (1) do some manual rounding or (2) provide some tolerance.

1 Like

Okay. In that case, I personally prefer something more like this:

correct: numericValue("\\abs(\${input.numericValue}-(1/3))")<0.01

The expected answer is readily apparent as well as the tolerance. Maybe, it looks a little more complicated, but it also gives the ease of a variable if desired.

2 Likes