As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [currency]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
77 votes
7 answers
6k views

What's the use case for formatting monetary values with a *system-dependent* currency symbol?

Many high-level programming languages have built-in features to format a number with a system-dependent currency symbol: -- Outputs $100.00 (en-US) or € 100,00 (de-AT) Console.WriteLine(100.ToString(&...
Heinzi's user avatar
  • 9,636
4 votes
5 answers
641 views

How do you assess the damage in a system that has been using floats or doubles for money?

I've been assigned to a code base responsible for millions of dollars of transactions, per quarter, and has been in use for over a decade. Sifting through the solution, I see doubles used everywhere ...
8protons's user avatar
  • 1,359
6 votes
3 answers
3k views

How to manage different currencies on the same e-commerce system?

Having one e-commerce system for multiple markets. Having markets related 1:1 to currencies. Having one database storing all order information (cost, price, invoicing) How to manage different ...
koalaok's user avatar
  • 493
12 votes
3 answers
2k views

Is there a single data representation that works for all currencies (even those different from Dollars, Euros, and Pounds)?

I can find many questions about libraries to use for representing amounts in some currency. And about the age old issue of why you shouldn't store currency as an IEEE 754 floating point number. But I ...
Kat's user avatar
  • 330
0 votes
0 answers
57 views

Foreign currency processing

We are looking to expand our e-commerce store to allow customers in countries outside of the United States to shop and see prices specific to their region. The prices are not just straight markups ...
Josh's user avatar
  • 111
12 votes
3 answers
35k views

Why is BigDecimal the best data type for currency? [duplicate]

I was reading this question and the accepted answer says that BigDecimal is the best type for representing currency values. I've also seen several other questions support the use of big decimal. Why ...
MxLDevs's user avatar
  • 779
5 votes
1 answer
1k views

Custom class for monetary amount (money value) instead of BigDecimal

On StackOverflow I found multiple advices to stick with BigDecimal in Java instead of reinventing the wheel. Despite that, I decided to create my custom class, and I would ask if that was a good idea ...
Piotr Müller's user avatar