|
|
|
|
|
by grishka
1482 days ago
|
|
Why would you ever want monetary amounts as fractions or any kind? Why would you want to separate dollars from cents? Just represent them in cents or other smallest units ($15.27 would be 1527), and only make the distinction between dollars and cents for human-readable output. Problem solved. I don't understand what BCD would solve here vs plain binary integers. |
|
If you can exchange arbitrary currency (and other commodity) in specified whole units with no other restrictions, then if you need to track prices, the prices need to be tracked as arbitrary rational numbers.
BCD is, of course, inadequate for that, but it's the most general reason for why monetary amounts may need fractions, IMO.
BCD does mean that when the requirements change from “we need to track to the cent” to “we need to track to the mil”, you change one constant as to the minimum allowed precision, and no other code or existing data. Whereas “use integer multiples of the minimum unit” makes that messier. Also, if you have different minimum units in different parts of an enterprise, using BCD makes sharing between them easier.