vims liu
vims liu

Reputation: 643

javascript float or double for handling currency/money value

Which type to use (float or double) for handling currency/money? At the moment I am using float for handling currency/money. I searched through the net, but found nothing. I know this is a question that includes debate which is not allowed, but I need some explanation for me to decide.

Thanks

Upvotes: 0

Views: 1067

Answers (2)

Dmytro Shevchenko
Dmytro Shevchenko

Reputation: 34581

All numbers in JavaScript are 64-bit floating point numbers, i.e. double.

See the following links for more information:

http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference

http://www.crockford.com/javascript/survey.html

You don't have a choice in regard to the way your numbers are stored.

Upvotes: 0

Quentin Roy
Quentin Roy

Reputation: 7887

There is only one type of number in javascript. So you don't really have a choice.

Upvotes: 1

Related Questions