Fórum Fórum

Voltar

Rounding numbers

Alternar
Rounding numbers
Resposta
16/09/20 13:11
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 Votos)

RE: Rounding numbers
Resposta
16/09/20 15:57 em resposta a 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 Votos)

RE: Rounding numbers
Resposta
21/09/20 14:34 em resposta a 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 Votos)