# Checking correctness of fraction answer

**URL:** <https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [April 18, 2020, 9:28am UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854 "2020-04-18T09:28:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aline\_MacDonald](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/aline_macdonald/32/658_2.png) [@Aline\_MacDonald](https://cl.desmos.com/u/Aline_MacDonald)\
**Post date:** [April 18, 2020, 9:28am UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/1 "2020-04-18T09:28:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [April 18, 2020, 4:16pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/2 "2020-04-18T16:16:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Moniki](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/moniki/32/707_2.png) [@Moniki](https://cl.desmos.com/u/Moniki)\
**Post date:** [April 27, 2020, 12:51pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/3 "2020-04-27T12:51:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [April 27, 2020, 4:34pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/4 "2020-04-27T16:34:43Z")

</div>

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.

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

```

---

<div class="post-metadata">

**Author:** ![Moniki](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/moniki/32/707_2.png) [@Moniki](https://cl.desmos.com/u/Moniki)\
**Post date:** [April 27, 2020, 4:45pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/5 "2020-04-27T16:45:19Z")

</div>

Thanks so much! I appreciate your input!!

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [April 27, 2020, 7:03pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/6 "2020-04-27T19:03:27Z")

</div>

You can also just do

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

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

---

<div class="post-metadata">

**Author:** ![JayChow](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/jaychow/32/1674_2.png) [@JayChow](https://cl.desmos.com/u/JayChow)\
**Post date:** [April 27, 2020, 7:28pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/7 "2020-04-27T19:28:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [April 27, 2020, 9:10pm UTC](https://cl.desmos.com/t/checking-correctness-of-fraction-answer/854/8 "2020-04-27T21:10:52Z")

</div>

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.
