# Controling for the number of decimal places

I am creating an elementary activity around decimal operations using money as a context. I have a slider in a graph and the label I am using shows the total amount of money spent as a function of quantity. The label does not always show two decimal places (hundredths). Is there a way to set the output to show hundredths even when the value in this place is zero?

example: forced display of 3.30 instead of 3.3

Don’t know if it’s supported. Here’s my idea for a workaround:

In the graph: (b= student input, a= rounded value)
a=round(b,2)
c_heck={a=round(b,1):1,2} #checks how many places the display value would show by seeing if rounding to 1 and 2 decimal places is the exact same value

In CL: (P= your point for display)
pointLabel(“P”): when number(“c_{heck}”)=1 “\${a}0” otherwise “\${a}”

Basically, if the calculator would only display one decimal place, I’m adding the 0 placeholder on in the label.

You can nest conditionals to include 0 decimal places
c_heck={a=round(b,0):0,{a=round(b,1):1,2}}

Another alternative would be to define a variable that captures the first two decimal places as individual variables. Define the labels based off those variables. Graphing Calculator

3 Likes

I like your solution because it can all be done in the graph.

Wow, I will give this a shot. Thank you!

That worked Perfectly! Thanks!!

Is there a way for teachers to insert a new slide as they are live in the activity. We always make an activity that might be better if a new question or explanation or definition is asked. Or having the students five deeper in the concept.

David

No, once students start an activity, they’re locked into that version. You’ll see in your dashboard a line stating that those sessions are an older version if you’ve made edits to an activity.

I’d love this feature as well, or a nearby cousin of it – the ability to move everyone from one activity to another without having to convince them to type a new code.

So you could have it with them all on one activity and then you send them all over to another activity and potentially back again, rather than editing the first activity.

1 Like

Hi Serge, I used your suggestion to have a value report with two decimal places. It appears that it truncates (rather than rounds).

If I change
h_undredth = mod(floor(100a),10) to
h_undredth = mod(round(100a),10)
it appears to provide a rounded value on a couple of checks.

But I’m new to all this, so I’m asking if my thinking is correct. TIA

Oops. It looks like I was addressing the wrong problem, but I’m glad you were able to modify things to work.

The floor function you have will get the digit in the hundredths place, and the round function definitely will get the correctly rounded digit if you want two decimal rounding from the hundredths place.

This old computing hack works for rounding, too:

h_undredth = mod(floor(100a+.5),10)