Reputation: 35843
I am implementing a currency converter with javascript, e.g., convert USD to SGD. Do you know any article or trick about concerns like precision issue that I need to tackle?
Thanks.
Upvotes: 1
Views: 201
Reputation: 50832
Accuracy seems to be the biggest issue here. There are many good sources to be found around the internet. This short article by William Bontragerone handles the accuracy problem sufficently.
Upvotes: 3
Reputation: 5782
Just retain precision until you have to display the results on the page. And always prepare for the possibility that the user could put anything as input, including telephone numbers.
Upvotes: 2