decimal vs double



Apparently, financial calculations should be performed with decimal not
double, however .NET does not make it easy to work with decimal.

Literal numeric non-integral values are by default treated as doubles.

The constants in System.Math (Pi,E) are doubles.

What are the relative benefits of using decimal to store financial data ?



.



Relevant Pages

  • Re: Financial operation [Hibernate]
    ... In the early days people writing in MS-Basic used doubles for monetary values and, like spreadsheets, caused periodic financial havoc. ... Some dialects can do floating point but its almost never used for financial calculations. ... OK, maybe for currency conversions but nothing else I can think of, and even currency conversions are typically defined as fixed point calculations with the number of decimal places, the order of operations and the rounding rules legally specified. ... martin@ | Martin Gregorie ...
    (comp.lang.java.programmer)
  • Re: sorry .09 instead of .08
    ... > doubles for financial calculations. ... that's really the bottom line isn't it :-) Use whatever works for you, ... Prev by Date: ...
    (comp.lang.java.help)