Reputation: 25312
As input to my algorithm I get integer values which are scaled by 10. So if I get 10 it is actually 1, if I get 1 it is actually 0.1. I need to convert it to fractional representation for calculations and then convert back for output. I guess if I convert numbers to double there is a risk to loose some accuracy during convertations. What is the right way to solve this problem.
Upvotes: 0
Views: 149
Reputation: 347
The decimal type offers higher accuracy (than floating point) for 10-base calculations, and that's what I would use.
Upvotes: 3