mardi 28 janvier 2020

How to round off up to 4 decimal places that will be input based?

I have a problem here to solve this problem. I have a feature where a user will input a given value for the cent (precision) and will be automatically round off the prices.

So for example, the given value for the price is 100.123456 and the user input 1 cent

So the expected output will be 100.1

because 1 cent is equal to 0.01

In that case, I have no problem, I can make a formula for that case. But for that case, the decimal places that will be rounding off is only 2 decimal places or up to hundredths only.

I am thinking if how can I solve if up to 4 decimal places and the user will be input 10.12 for example and will be converted as 0.1012 so that up to 4 decimal places.

Thank you so much!!!! I badly need your help! Thank you.




Aucun commentaire:

Enregistrer un commentaire