How to limit the number of digits after a decimal place

I’ve been playing around with writing a little currency conversion app. It does basically what I wanted it to do, and I learned about using APIs. I would like to polish it up design wise a bit, and I’m having a problem with the result of dividing to get the exchange rate after a value is entered. Say I enter 32 $CAD and the result that comes back is $USD26.35336324673464. I obviously am only interested in the first two decimal places. Using the ROUND block just gives me an integer, which is OK, but if basically renders the currency conversion almost useless, as the cents matter too! Any ideas on how to do this?

1 Like

Hi @Pest,

Take a look at @jane’s tutorial that shows how to round to any number of decimal places:

multiply number by 100 then round then divide by 100
it moves 26.3533 to 2635.33 and then rounds that to 2635 then divide by 100 to get 26.35

1 Like