CL okay but preview is incorrect

I am sure that I am missing something very simple. I did have this working earlier but it is not working now. In the CL there is no error indicated in for it. However, when I preview the question to see if it works the solution is marked as incorrect. (Yes, I have checked to see that I an entering the solution correctly… LOL!

check1 = numericValue(“{this.cellContent(1,1)}/{this.cellContent(1,2)}”) = numericValue(“1/frac{1}{7}”)
correct = check1
correct: correct

Hello, I think there some errors in your CL code,
something like this should work:

fn = simpleFunction("a/b", "a", "b")

correct =  fn.evaluateAt(this.cellNumericValue(1,1),this.cellNumericValue(1,2)) = 7
correct: correct

I think the issue here may actually be the target answer. If you’re checking equality to a non-terminating decimal, you may get errors because they’ll get rounded. In this case, you’ll want to check an inequality within a tolerance. I’d suggest something like this, which is essentially the absolute value of the difference between student input and target answer:

check1 = numericValue(`\abs(\frac{${this.cellContent(1,1)}}{${this.cellContent(1,2)}}
   -\frac{8}{7})`) <= 0.01

Should the original CL work for a non-terminating decimal then? Because it is not? I am definitely trying the all of the suggested CL.

It looks like you want a fraction in the denominator, right? So you would want to use \frac{}{} twice, like \frac{ 1 }{ \frac{ 1 }{ 7 } }

I would still use the tolerance method that others have mentioned, but this is how I would write the CL using your original method:

I did get the other two suggestions to work for what I needed. However, I am still confused by my original CL. I am not the most experienced at this for sure but I did have something close to my original post that was working. What I thought my CL was checking… any value entered in (1,1) when divided by the value in (1,2) the answer would be 8/7 or 1 1/7. I am happy to use the other suggestions but just when I thought I was getting something under my very “inexperienced belt” and able to work through some issues… I got myself stumped on this one. Again, I am just being stubborn because I had something similar to my original post that work… I accidentally erased it… and now I can’t seem to figure out what I did. I am annoying myself right now.

Your original would work for a terminating decimal, but not for non-terminating, depending on how it rounds. Using inequalities is more reliable for non-terminating decimals.

I’ll be honest, it’s rare that I’ve had problems checking if a difference equals 0 even with non-terminating decimal, but often had difficulty comparing to values other than 0. To be certain, inequalities are the way to go.

Oh, I misunderstood - I thought you were doing 1/(1/7). I think in your original code you have a forward slash instead of backslash. And any time you are doing division, like with the two cells, you will probably want to format it as a fraction. So, like this:

check1 = numericValue("\frac{${this.cellContent(1,1)}}{${this.cellContent(1,2)}}") = numericValue("1\frac{1}{7}")
correct = check1
correct: correct

cellSuffix(1,2): when correct "yes" otherwise "no" 

initialCellContent(1,1):`8`
initialCellContent(1,2):`7`