0

The question Why is BigDecimal the best data type for currency? has been marked as a duplicate of a question about numerical approximation of floating point data.

Persons who recognised this as a duplicate probably thought to accounting software or related questions. There is however industry fields where software uses float to represent currencies, which happens to be a perfectly valid approach—of course, we do not talk of accounting software here!

So the correct answer to this question is “BigDecimal is not the best data type for currency” and the question is not a duplicate.

How can we remove the “duplicate” annotation?

3
  • asked ans answered at MSO: Someone flagged my question as already answered, but it's not
    – gnat
    Mar 6, 2014 at 7:50
  • as far as I can tell, your edit suggestion has been rejected; consider taking a look at this MSO post if you look for more confidence in getting edit suggestions through
    – gnat
    Mar 6, 2014 at 11:56
  • I looked over all 3 linked questions, and their answers, and have to agree that I wouldn't consider it a duplicate. I'm voting to reopen, however it still needs 4 other community votes (or 1 mod vote) to get reopened. In fact, I don't think the other two are duplicates either and am also voting to reopen those. The differences are especially noticeable when comparing the top voted answers to both.
    – Rachel
    Mar 7, 2014 at 19:51

1 Answer 1

2

As the one who started the duplicate on that close vote I wish to draw your attention to:

Why is BigDecimal the best type? I don't understand the relevance of arguments such as precise calculations or people with large net worth. I am pretty sure that there are no currencies that round to the 10th decimal place, and almost no one has 8-bytes worth of money (if it were to store it as a long).

For taxes and other intermediary calculations, I can see how it is important to make sure you are using a proper type that doesn't round/truncate values prematurely, but that doesn't seem relevant to me either since an error of 0.0000000001 cents on the dollar does not seem that big to me.

It may be due to my lack of understanding of the importance of accuracy when it comes to financial statements, so perhaps someone can also clarify whether a millionth of a cent is significant as a final number.

This is the question.

In the question it was duped to:

I can't imagine that last digit being much of a problem in real life. For example, if I ask for a "0.30000000000000004 meter metal rod", I'm not going to later complain that "this rod is 0.00000000000000004 meters too long!" (I can just cut the extra off, right? :)

In my reading, these are the same question worded differently. The origin refers to currency, the dup target is one that deals with currency and the broader issue of floating point inaccuracy.

The answers in the duped question directly answer the "an error of 0.0000000001 cents on the dollar does not seem that big to me." portion

4
  • The question says “For taxes and other intermediary calculations…but…” so the dependence on the application is an explicit aspect of the question. And yes, there is application where currencies are represented as floats and where it is the right thing to do. The two questions are similar but this one is broader as the previous one (context is not so well defined), so I believe it is not the same question. Actually, I managed to give another response, which should prove that questions are distinct!
    – user40989
    Mar 7, 2014 at 8:32
  • 1
    The 'managed to give a response' isn't a good metric. I could have copied most of my answer from the other question and pasted it in there and had a valid answer there too... which would argue that the two questions are the same. (see MSO)
    – user40980
    Mar 7, 2014 at 18:43
  • this MSO suggests about the same, but looks even more appropriate (and it's newer, and it answers the question built on Programmers case)
    – gnat
    Mar 8, 2014 at 19:19
  • @MichaelT This was “managed to give another response”.
    – user40989
    Mar 10, 2014 at 8:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .