Link to home
Start Free TrialLog in
Avatar of gem56
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
Avatar of Sethi
Sethi
Flag of India image

Decimal.
SOLUTION
Avatar of Daniel Reynolds
Daniel Reynolds
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gem56
gem56

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