Round to specified decimal places

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
jam
Posts: 4
Joined: 06 Aug 2015 13:18

Round to specified decimal places

Post by jam » 06 Aug 2015 13:27

It seems the current round function only rounds to the nearest integer. I need a round function to round to the nearest (specified number of) decimal places.

I have a Flow that takes a dollar amount from an SMS message and converts it to a number to add to another dollar amount from another SMS. Problem is that when the dollar amount is converted to a number there are about 15 decimal places that show up (29.29999999999997). Later in the Flow I want to copy this amount to clipboard so I can paste it into an application (money management app) as a dollar amount when the app is launched.
JAM (I like peanut butter too)

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Round to specified decimal places

Post by Martin » 06 Aug 2015 19:38

Hi,

{var,numberformat,0.00} should work in a text field of an action.
rounded_value = "{var,numberformat,0.00}"; should work in a script

Regards,
Martin

jam
Posts: 4
Joined: 06 Aug 2015 13:18

Re: Round to specified decimal places

Post by jam » 06 Aug 2015 20:05

Good enough ... thanks Martin that'll work just fine!
JAM (I like peanut butter too)

Locked