We are rewriting our legacy Accounting System in VB.NET and SQL Server. We brought in a new team of .NET/ SQL Programmers to do the rewrite. Most of the system is already completed with the Dollar amounts using Floats. The legacy system language, I programmed in, did not have a Float so I probably would have used a Decimal.
What is your recommendation?
Should Float or Decimal data type be used for dollar amounts?
What are some of the pros and cons for either?
One Con mentioned in our daily scrum was you have to be careful when you calculate an amount that returns a result that is over two decimal positions. It sounds like you will have to round the amount to two decimal positions.
Another Con is all displays and printed amounts have to have a Format Statement that shows two decimal positions. I noticed a few times where this was not done and the amounts did not look correct. (i.e. 10.2 or 10.2546)
A pro is the Float only takes up 8 bytes on disk where the Decimal would take up 9 bytes (Decimal 12,2)
Thanks