掲示板 掲示板

戻る

Rounding numbers

トグル
Rounding numbers
答え
20/09/16 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 投票)

RE: Rounding numbers
答え
20/09/16 15:57 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 投票)

RE: Rounding numbers
答え
20/09/21 14:34 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 投票)