gem56
asked on
What is the best data type to use for currency
Hi guys,
What is the best data type to use for currency. I ask this because currently I am using 'Single' data type however it often gives me 15.4999999, etc. so I have to keep rounding that to 2 decimal places and formatting. That seems so inefficient, especially if there is significant amount of computation being done.
Any suggestions?
/Michael
What is the best data type to use for currency. I ask this because currently I am using 'Single' data type however it often gives me 15.4999999, etc. so I have to keep rounding that to 2 decimal places and formatting. That seems so inefficient, especially if there is significant amount of computation being done.
Any suggestions?
/Michael
Decimal.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tanks for that guys.
I considered using Decimal type but thought in light of its size (8 bytes) that Single was more efficient to use (4 bytes). I'll try Decimal type but it seems I can't get away from using Round and Format functions. It's OK for now but in future if I need to do more repetitive computation I may feel different.
/Michael
I considered using Decimal type but thought in light of its size (8 bytes) that Single was more efficient to use (4 bytes). I'll try Decimal type but it seems I can't get away from using Round and Format functions. It's OK for now but in future if I need to do more repetitive computation I may feel different.
/Michael