Number action Calculate - Round

(Aleksey Litvinov) #1

Hi all, could you pls help me with next issue:

i need to round the result in calculation, how can i do it in flow xo?

could’t find such function at Number Calculation

Thank you in advance
Alex

(Karen Barker) #2

Hi Alex,

To what extent are you looking to be able to round numbers. Using the Format Number option would work if for example you were returning a value to x decimal places in your calculation and you wanted the nearest whole number for instance.

If you’re looking to round to the nearest 10 for example though you’d need to use the Code service in order to manipulate the value using Javascript. There’s a post here which should provide the code you’ll need to round to 10.

(Aleksey Litvinov) #3

Hi Karen, thank you for quick response!

for example, i have result of calculation 3.15688432115

and i need to round it to 3.15

how can i do it?

Thank you

(Peter) #4

Are you sure you are not truncating the number? Rounding 3.156 to two decimals gives 3.16, not 3.15…

(Karen Barker) #5

If you want to round to 2dp you could still use the Format Number option to do this just select the format option of 0.00. :slight_smile:

(Aleksey Litvinov) #6

right you are 3.16, thanks!

(Aleksey Litvinov) #7

Thank you Karen!:ok_hand: