# Automatically Rounding Within A Table

**URL:** <https://cl.desmos.com/t/automatically-rounding-within-a-table/4286>\
**Category:** Questions\
**Created:** [May 10, 2022, 2:41pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286 "2022-05-10T14:41:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Bradford](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/philip_bradford/32/2083_2.png) [@Philip\_Bradford](https://cl.desmos.com/u/Philip_Bradford)\
**Post date:** [May 10, 2022, 2:41pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/1 "2022-05-10T14:41:27Z")

</div>

Greetings Desmos aficionados,

I am trying to get it to automatically round a table cell (integer would be fine). I’ve been trying to use \round, but just can’t seem to get it to work.

cellContent(3,2): “{numericValue("{T}/${M}”)}"

If you would like to see it, go to slide 11:  
[https://student.desmos.com/join/mq3va8](https://student.desmos.com/join/mq3va8)

Thanks!

---

<div class="post-metadata">

**Author:** ![pirsquared](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pirsquared](https://cl.desmos.com/u/pirsquared)\
**Post date:** [May 10, 2022, 2:50pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/2 "2022-05-10T14:50:10Z")

</div>

> [@Philip\_Bradford](#):
>
> cellContent(3,2): “{numericValue(" Extra open brace or missing close brace{numericValue(" {T}/${M}”)}"
> 
> If you would like to see it, go to slide 11:  
> [Desmos Classroom Activities](https://student.desmos.com/join/mq3va8)

Could you share the teacher link rather than the student link so we can see the code behind it?

It looks like the forum might have mangled the code in your post somewhat. In general though I would use:

```auto
round=simpleFunction(`\operatorname{round}\left(x,2\right)`)
cellContent(3,2): "${round.evaluateAt(.....)}"

```

---

<div class="post-metadata">

**Author:** ![Philip\_Bradford](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/philip_bradford/32/2083_2.png) [@Philip\_Bradford](https://cl.desmos.com/u/Philip_Bradford)\
**Post date:** [May 10, 2022, 2:52pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/3 "2022-05-10T14:52:01Z")

</div>

Sorry about that, I didn’t realize there was a separate teacher link.

I’m thinking this is the correct link?

> **[6-7 Gaming Probability, Math 2 • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/627508ad01cfb50523e24d64?collections=61254edac01c2b45e98acc85)**
>
> by Philip Bradford

Greatly appreciate you taking a look at this for me!

---

<div class="post-metadata">

**Author:** ![pirsquared](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pirsquared](https://cl.desmos.com/u/pirsquared)\
**Post date:** [May 10, 2022, 3:05pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/4 "2022-05-10T15:05:21Z")

</div>

The following tweaks should sort you if I’ve interpreted your code correctly.

```auto
M12=numericValue("12*${M}")
round=simpleFunction(`\operatorname{round}\left(x\right)`)
TdivM=numericValue("${T}/${M}")

cellContent(3,1): "Entire\ class:\ ${M12}"

cellContent(3,2): "${round.evaluateAt(TdivM)}"

```

I can’t really test it without sitting and unpicking where each bit of data is coming from but if you make those changes and report back we might be able to assist further.

The reason I’ve moved the numericValue stuff out into separate variables is to avoid situations where you have quotes inside quotes, like

```auto
"${numericValue(".....")"

```

as this invariably throws off the parser. Probably get around it with backticks but much cleaner to just pull it out to be completely separate.

---

<div class="post-metadata">

**Author:** ![Philip\_Bradford](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/philip_bradford/32/2083_2.png) [@Philip\_Bradford](https://cl.desmos.com/u/Philip_Bradford)\
**Post date:** [May 10, 2022, 3:17pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/5 "2022-05-10T15:17:41Z")

</div>

Thank you!  
I just tried it out, and I think it will work.

I have a class coming in next period, so that will be the ultimate trial.

I also appreciate the explanation about using too many quotes, I never knew that made a difference.

---

<div class="post-metadata">

**Author:** ![pirsquared](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@pirsquared](https://cl.desmos.com/u/pirsquared)\
**Post date:** [May 10, 2022, 4:58pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/6 "2022-05-10T16:58:34Z")

</div>

> [@Philip\_Bradford](#):
>
> I also appreciate the explanation about using too many quotes, I never knew that made a difference.

Yeah, it’s more about the fact they don’t nest within each other, so the first " is interpreted as the opening of a quote but the subsequent one is considered to be the close rather than the opening of a nested one. So while you might expect

" **blah blah “blah blah” blah**"

the parser sees

" **blah blah**" ~~blah blah~~" **blah**"

if you catch my drift.

---

<div class="post-metadata">

**Author:** ![Philip\_Bradford](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/philip_bradford/32/2083_2.png) [@Philip\_Bradford](https://cl.desmos.com/u/Philip_Bradford)\
**Post date:** [May 10, 2022, 5:43pm UTC](https://cl.desmos.com/t/automatically-rounding-within-a-table/4286/7 "2022-05-10T17:43:14Z")

</div>

Got it.

I just had a class and it worked perfectly.

Much appreciated!
