locked
what date type should be used for money values? RRS feed

  • Question

  • I have an app the uses double for monetary values with no issues.  I've read that the decimal is a better choice for money.  I doubt it's worth changing the doubles to decimals in my app.  But, I think I'll use decimals for money values in the future if it is the better type.

    What data type should be used for money values?

    Sunday, April 25, 2010 4:35 PM

Answers

  • If you read the documentation for Decimal , you´ll see that this type handles rounding better than doubles.

    The fact that your app uses doubles "with no issues" might simply mean that no accountant has checked the results, rather than that there are no problems.

    I think it´s safe to say that you should use Decimal in order to provide increased monetary accuracy to your app.

    Cristian.

    Sunday, April 25, 2010 5:07 PM