Message Boards Message Boards

Back

Rounding numbers

Toggle
Rounding numbers
Answer
9/16/20 1:11 PM
Hello,

I'd like to round a calculation to one decimal place. I used the purple "round" action block in the Value actions category, and this works, but it is rounding to the closest whole integer. Is it possible to round to one decimal place?

Thanks
0 (0 Votes)

RE: Rounding numbers
Answer
9/16/20 3:57 PM as a reply to Pat Telan.
Hi Pat,
Great question! You actually cannot control what decimal you're rounding to, but there's a pretty easy workaround. Let's say you have a number 2.576 that you want to round to 2.6. I will take 2.576, multiply it by 10, round, and then divide by 10. See attached image.

You can also use a Number Input object, and set it to read only and use 1 decimal place, but this doesn't actually round, it only truncates - so 2.576 would become 2.5. However, using a Number Input object set to read only is a great way to format your values. https://www.screencast.com/t/mhmm7r6q8sW

Hope that helps!
0 (0 Votes)

RE: Rounding numbers
Answer
9/21/20 2:34 PM as a reply to Navdeep Dhillon.
This is great. Thank you! I'll use the first approach since I don't need to use prefixes or suffixes.
0 (0 Votes)