Ricky
Ricky

Reputation: 35843

Javascript numerical calculation concerns

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

Answers (2)

Thariama
Thariama

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

Neil
Neil

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

Related Questions