Questions tagged [currency]
7 questions
77
votes
7 answers
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("C")); // C#
? FormatCurrency(100) …

Heinzi
- 9,646
- 3
- 46
- 59
12
votes
3 answers
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 can't seem to find anything more. Surely there's…

Kat
- 330
- 1
- 10
12
votes
3 answers
Why is BigDecimal the best data type for currency?
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 is BigDecimal the best type? I don't understand…

MxLDevs
- 779
- 3
- 10
- 15
6
votes
3 answers
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 currencies?
normalise all saved data to one single…

koalaok
- 493
- 5
- 17
5
votes
1 answer
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 and pros or cons about my design in comparsion to…

Piotr Müller
- 551
- 1
- 4
- 7
4
votes
5 answers
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 to represent money and arithmetic is done on these…

8protons
- 1,359
- 1
- 10
- 27
0
votes
0 answers
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 from the US prices; we build the cost to ship the…

Josh
- 111
- 2